Equinox Online Help

Home

Binary operations

All of the logical and comparative operators also act as binary operators. These operators are: And, Or, Xor, Not, <, <=, =, <>, >=, >, <<, >>. A binary operator treats the operands as binary data and hence returns a binary result. Consider the following:

number result | variable declaration
result = 15 And 7

The operation sets result to seven, reflecting the binary nature of the operation. However, seven is True (not equal to zero) so result is also True reflecting the logical nature of the operation. Consider the following:

number result | variable declaration
result = "Mr" >> "Smith, Mr H.L"

In this case result is set to eight, which is also True. In comparative expressions, operators are assumed to be logical (not binary) unless they are enclosed in brackets.

eg The following expression has a logical operator:

if found And alive then ...

However, the next example has a binary operator:

if (BitField And bitmask) then ...

Note that you may also use the new BinaryAnd, BinaryOr and BinaryXor operators for greater readability and to avoid using brackets.