The And
, Or
and Xor
operators are called the conditional logical operators. They are only defined on the type Boolean
and short-circuit, which is to say in certain situations the second operand will not be evaluated at runtime.
The conditional logical operators are evaluated as follows:
And
operation evaluates to False
, then the expression returns False
. Otherwise, a logical AND operation is performed on its two operands.Or
operation evaluates to True
, then the expression returns True
. Otherwise, a logical OR operation is performed on its two operands.Xor
operator always performs a logical exclusive-OR operation on its two operands.Note that in the case of And
and Or
the first operand is only ever evaluated once, and the second operand is either not evaluated or evaluated exactly once.
And
Expression |Or
Expression |Xor
Expression