Xor
Operator
Definition: Performs a logical exclusion on two expressions.
The XOR operator is a crazy one. XOR evaluates two expressions and returns Trueif the two are different; that is, if one expression is True and the other expression is False. If both expression are true (or false) then XOR returns False.
We told you it was crazy.
Here’s an example. This command evaluates the following two statements, then stores its verdict in the variable $a:
· 23 is less than 12
· 12 is greater than 40
Here’s the command
$a = 23 - gt12 - xor12 - lt40
Because both expressions are true, if you run the command and then echo back the value of $ a you’ll get the following:
False