Boolean (logical) operators

Logical operators can only be used with arguments that can be evaluated to a boolean. The result of a logical operation is a boolean. The following table shows the logical operators that are available in AL.

Boolean operators

As the following table shows, the not operator is a unary prefix operator. This means that it takes only one argument and is placed in front of the argument. The and, or, and xor operators are binary infix operators; they take two arguments and are placed between the corresponding arguments.

OperatorNameExpressionResulting data type
notLogical negationnot boolBoolean
andLogical andbool1 and bool2Boolean
orLogical orbool1 or bool2Boolean
xorExclusive logical orbool1 xor bool2Boolean

AL operators
Arithmetic operators
Relational operators