5 Operators and Functions
AND compares two expressions. If both expressions are true (a non-zero value), the result is true. If one or both of the expressions are false (zero), the result is false.
numeric expression AND numeric expression
OR (inclusive OR) compares two expressions. If either expression is true, the result is true. If both expressions are true, the result is true. If both expressions are false, the result is false.
numeric expression OR numeric expression
EXOR (exclusive OR) compares two expressions. If only one of the expressions is true, the result is true. If both are true or both are false, the result is false.
numeric expression EXOR numeric expression
NOT changes the logical value of an expression. If the expression is true, NOT changes it to false. If the expression is false, NOT changes it to true.
numeric expression EXOR numeric expression
As in the case of relational operators, if the result is true, a 1 is returned; if the result is false, a 0 is returned.
The expressions that the logical operators compare can be either relational or non-relational:
A | B | A AND B | A OR B | A EXOR B | NOT A |
---|---|---|---|---|---|
T | T | 1 | 1 | 0 | 0 |
T | F | 0 | 1 | 1 | 0 |
F | T | 0 | 1 | 1 | 1 |
F | F | 0 | 0 | 0 | 1 |