Logical (boolean) operators

REXX comparison expressions return a true (1) or false (0) value when processed. Logical operators combine two comparisons and return the true (1) or false (0) value depending on the results of the comparisons.

The logical operators are:
Operator
Meaning
&
AND
Returns 1 if both comparisons are true. For example:
(4 > 2) & (a = a)        /* true, therefore result is 1  */
(2 > 4) & (a = a)        /* false, therefore result is 0 */
|
Inclusive OR
Returns 1 if at least one comparison is true. For example:
(4 > 2) | (5 = 3) /* at least one is true, therefore result is 1 */
(2 > 4) | (5 = 3) /* neither one is true, therefore result is 0 */
&&
Exclusive OR
Returns 1 if only one comparison (but not both) is true. For example:
(4 > 2) && (5 = 3) /* only one is true, therefore result is 1 */
(4 > 2) && (5 = 5) /* both are true, therefore result is 0 */
(2 > 4) && (5 = 3) /* neither one is true, therefore result is 0 */
Prefix ¬ \
Logical NOT
Returns the opposite response. For example:
\ 0               /* opposite of 0, therefore result is 1 */
\ (4 > 2)         /* opposite of true, therefore result is 0 */
Logical expressions are used in complex comparisons and can act as checkpoints to stop unwanted conditions (such as testing a field for a value of zero before using it as a divisor). If you have a series of logical expressions, for clarification, use one or more sets of parentheses to enclose each expression. For example:
(#46 = 999) | ((#45 > 0) & (#46 / #45) >= .5)