Skip to content

LogicalExpression

Paul Lipkowski edited this page Aug 22, 2022 · 2 revisions

LogicalExpression is an entity type used in PapajScript. It stores instructions that may be executed when calling it. The set of instructions is meant to return either true or false. Logical expressions are used in conditionals and some prebuilt functions (e.g. Array.filter). The LogicalExpression is a successor of a ( <instructions> ) expression, which technically used to be an entity of Function type, and it was introduced in October 2020. The first RPN Calculator stable version that has LogicalExpressions is 0.5.1.

Syntax

  • ( <instructions> )

Examples

  • ( $x 0 >= ) checks if x variable is non-negative
  • ( $x 0 >= $y 0 >= or ) checks if x variable is non-negative or y variable is non-negative
  • ( 0 >= ) checks if the value being on the top of the PS stack is non-negative
  • $T ( 0 >= ) Array.filter filters the non-negative values from T array
Clone this wiki locally