difference

operator

Return type:
Integer
Returns:
A new bit sequence.
Syntax
numeric-expression difference numeric-expression


Purpose

The difference of two bit sequences is a new sequence where each bit is:

  • 1 if the corresponding bit in each of the operands is different.
  • 0 if the corresponding bit in each of the operands is the same.

Other languages sometimes refer to this operation as a "bit-wise exclusive-or."

In this example, the action within the do block is performed if c and d have any corresponding bits with the same value:

  do when c difference d != 0
  ...
  done

Related Concepts