Tell when the expression will evaluate to true.
(a || b) && (!a || !b)
The left side is true
when at least 1 of a
and b
is true
. The right side is true
when at least 1 of a
and b
is false
. The expression is true
when either a
or b
is true
but not both.
This is known as exclusive or (xor). Some other programming languages offer xor as a logical operator.