SIMPOL Documentation

Logical Operators

Logical operators are used for doing boolean operations for the purpose of evaluating multiple conditions that are based on true and false values. They differ from arithmetic operators in that they typically only return .true or .false which is then used to make a decision about the flow of the program. They are commonly used together with comparison operators and arithmetic operators in branching and looping statements to evaluate whether the loop should continue or decide which branch to take.

and

Operand count

2 or more

Types

.nul, .inf, boolean, integer, number, string

Description

Gives a boolean result indicating whether or not all the operands are not .nul, the empty string (""), zero (0)or .false.

Behavior by type
Type nameResult for and when applied to this type
.nul If any operand is .nul then the result is .false
.inf If all operands are .inf then the result is .true, otherwise the result depends on the value of the other operands
boolean If any operand is .false then the result is .false
integer If any operand is zero (0) then the result is .false
number If any operand is zero (0) then the result is .false
string If any operand is the empty string then the result is .false

or

Operand count

2 or more

Types

.nul, .inf, boolean, integer, number, string

Description

Gives a boolean result indicating whether or not any operand is not .nul, the empty string (""), zero (0)or .false.

Behavior by type
Type nameResult for or when applied to this type
.nul If all operands are .nul then the result is .false otherwise the result depends on the value of the other operands
.inf If any operand is .inf then the result is .true
boolean If any operand is .true then the result is .true
integer If any operand is non-zero then the result is .true
number If any operand is non-zero then the result is .true
string If any operand is a non-empty string then the result is .true

not

Operand count

1

Types

.nul, .inf, boolean, integer, number, string

Description

Creates a result which is a logical opposite of the input operand

Behavior by type
Type nameResult when not is applied to this type
.nulThe result will be .nul
.infThe result will be .inf
boolean .true becomes .false, and .false becomes .true
integer 0 becomes 1, and any other value becomes 0
number 0 becomes the integer 1, and any other value becomes the integer 0
string The empty string becomes ".", and any other string becomes the empty string