
Xor Operator
| If expr1 is
| And expr2 is
| result is
|
| true (nonzero)
| true
| False (0)
|
| true
| false (0)
| True (-1)
|
| false
| true
| True
|
| false
| false
| False
|
| If bit in expr1 is
| And bit in expr2 is
| result is
|
| 0
| 0
| 0
|
| 0
| 1
| 1
|
| 1
| 0
| 1
|
| 1
| 1
| 0
|
Example
This example prints a message depending on the value of the variables A, B, and C, assuming that no variable is a Null. If A = 6, B = 8, and C = 10, both expressions evaluate False. Because both are False, the Xor expression is also False.
If A > B Xor B = C Then
Debug.Print "Only one comparison expression is True, not both."
Else
Debug.Print "Both comparison expressions are True or both are False."
End If