EasyLanguage Reserved Words & Functions

Xor (Reserved Word)

image\trumpet2.gif Disclaimer

This boolean operator is used in compare boolean values using Exclusive Or (XOR) logic.


Logical Expression Operator

When used in a logical expression, XOR returns True when the boolean values on either side of the XOR are different, as in the table below:

Exp1 Exp2 Exp1 XOR Exp2
True True False
False True True
True False True
False False False

Bitwise Binary Operator

When used with integer values, the XOR keyword functions as a bitwise operator, following the rules of the table below:

Bit1 Bit2 Bit1 XOR Bit2
1 1 0
0 1 1
1 0 1
0 0 0

Respective bits from each integer will be compared. If both bits are 0 or 1, the resulting bit will be 0. Otherwise the resulting bit will be 1.

For example, the integer expression 5 XOR 4 = 1    (x0101 XOR x0100 = x0001)