User Tools

Site Tools


logical_expressions.htm
Navigation:  Language Reference > 10 - Expressions > Types of Expressions >====== Logical Expressions ====== Previous pageReturn to chapter overviewNext page

Logical expressions evaluate true-false conditions in IF, LOOP UNTIL, and LOOP WHILE control structures. Control is determined by the final result (true or false) of the expression. Logical expressions are evaluated from left to right. The right operand of an AND, OR, or XOR logical expression will only be evaluated if it could affect the result. Parentheses should be used to eliminate ambiguous evaluation and to control evaluation precedence. The level or precedence for the logical operators is as follows:

Level 1 Conditional operators
Level 2 ~, NOT
Level 3 AND
Level 4 OR, XOR

Example:

LOOP UNTIL KEYBOARD()      !True when user presses any key

!some statements

END

IF A = B THEN RETURN.      !RETURN if A is equal to B

LOOP WHILE ~ Done#         !Loop while false (Done# = 0)

!some statements

END

IF A >= B OR (C > B AND E = D) THEN RETURN.

!True if a >= b, also true if

!both c > b and e = d.

!The second part of the expression

!(after OR) is evaluated only if the

!first part is not true.

See Also:

IF (conditional execution structure)

LOOP

logical_expressions.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1