Logical Expressions

Logical Literals

There are two Logical literal values: True and False. You can also use Null where the compiler is expecting a Logical value.

Logical Operators

All the Logical operators will take one or two Logical operands and yield a Logical result.

Logical And

The And operator is used to check if both the conditions are True. If either of the values is Null then a runtime error will be generated.

The system uses lazy evaluation with this operator. If the left-hand operand is False then the result will be False whatever the truth of the right-hand operand. So the system does not bother evaluating the second operand. This will general have no effect. If however the right hand operand contains a function call that has side effects then these side effects will not occur.

Logical Inclusive Or

The inclusive Or operator is used to check whether either of the conditions is True. If either of the values is Null then a runtime error will be generated.

The system uses lazy evaluation with this operator. If the left-hand operand is True then the result will be True whatever the truth of the right-hand operand. So the system does not bother evaluating the second operand. The side effect issue applies here as well.

Logical Exclusive Or

The exclusive Or ( XOr ) yields True if exactly one of the operands is True. If either of them is Null then a runtime error will be generated. As both sides always need to be tested there is never any lazy evaluation.

Logical Negation

Logical Not converts True to False and False to True. Null will generate a runtime error.

Equality Operators

The two equality operators, '==' and '<>', will work on Logical operands - including Null values - and yield a Logical result.