EasyLanguage Reserved Words & Functions
This boolean operator is used in compare boolean values using Exclusive Or (XOR) logic.
Xor
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 |
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)