Next: Binary Conditionals, Previous: Binary Arithmetic, Up: Operators [Contents][Index]
Binary logical operators are defined for integer scalars (Scalars) and arrays (Arrays), and combine corresponding bits in the operands according to the selected logical operation. The operator goes between the two operands. The data type of the result is the higest data type present among the operators.
The available logical operators are:
x AND y
and x & y
combine x
and y
such that
a bit in the result is only equal to 1 if the corresponding bit in
x
is equal to 1 and if the corresponding bit in y
is equal
to 1.
x OR y
and x | y
combine x
and y
such that a
bit in the result is equal to 1 if the corresponding bit in x
is
equal to 1 or if the corresponding bit in y
is equal to 1.
x XOR y
combines y
and y
such that a bit in the
result is equal to 1 if the corresponding bit in y
is unequal to
the corresponding bit in y
.