Previous Topic: ConditionNext Topic: Implied Subjects and Relational Operators


AND/OR Condition

You can combine conditional expressions using AND and OR as following: 

condition [{AND|OR} condition]…

Example

IF A=B AND C<D AND E>1
IF FOUND AND NOT RED
IF NOT $NUMERIC (AMOUNT) OR LIMIT>100

You can mix NOT, AND, and OR with parentheses to indicate the order in which to apply them. If you do not use parentheses, ANDs are evaluated before ORs. For example, the first expression is equivalent to the next expression,

IF (A=B AND C=D) OR E>F
IF A=B AND C=D OR E>F

And the following statement shows that the parentheses override the ¬, default of AND taking precedence over OR.

IF A=B AND (C=D OR E>F)

You can use the characters (¬), & and (|) interchangeably for NOT, AND, and OR, respectively. Therefore the first expression is equivalent to the next expression,

IF A=B AND (C=D OR E>F)
IF A=B & (C=D | E>F)

Combinations of conditional expressions are evaluated according to the following truth tables. (T=True, F=False, and U=Unknown conditions.)

AND

T

F

U

T

T

F

U

F

F

F

F

U

U

F

U

Thus, T and U yield U; F and U yield F; U and U yield U.

OR

T

F

U

T

T

T

T

F

T

F

U

U

T

U

U

Thus, T or U yields T; F or U yields U; U or U yields U.