mask

operator

Return type:
Integer
Returns:
A bit sequence.
Syntax
numeric-expresion mask numeric-expression


Purpose

mask is a bit-oriented operator used to help isolate, process and create binary values. The result of masking two bit sequences is a new sequence where each bit in the new sequence is one (1) if both corresponding bits in the masked sequence are one (1), and zero (0) if either of the corresponding bits is zero (0).

Other languages sometimes refer to this operation as a "bit-wise and" because the operation is analogous to the logical "and" operation. To avoid confusion, OmniMark reserves the keyword and and the operator "&" for the logical "and" operation.

The example shows a do block which will be executed if the lowest order bit in "c" has the value 1.

  do when c mask 1 != 0
  ...
  done

Related Concepts