Binary logical operators: AND OR

Unary logical operator: NOT

Syntax

a AND b

a OR b

NOT b

Description

The AND and OR logical operators return a logical value (true or false) based on the result of a comparison of two operands. In a logical AND, both expressions must be true for the result to be true. In a logical OR, if either expression is true, or both are true, the result is true; if both expressions are false, the result is false.

When dBASE Plus evaluates an expression involving AND or OR, it uses short-circuit evaluation:

false AND <any expL> is always false

true OR <any expL> is always true

Because the result of the comparison is already known, there is no need to evaluate <any expL>. If <any expL> contains a function or method call, it is not called; therefore any side effects of calling that function or method do not occur.

The unary NOT operator returns the opposite of its operand expression. If the expression evaluates to true, then NOT exp returns false. If the expression evaluates to false, NOT exp returns true.

You may enclose the logical operators in dots, that is: .AND., .OR., and .NOT. The dots are required in earlier versions of dBASE.