Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Exclusive or (XOR, EOR or EXOR) is a logical operator which results true when either of the operands are true (one is true and the other one is false) but both are not true and both are not false. In logical condition making, the simple "or" is a bit ambiguous when both operands are true. Because in that case it is very difficult to understand what exactly satisfies the condition. To remove this ambiguity, the "exclusive" term has been added to "or" to make it more clear in meaning.
Exclusive or is also known as exclusive disjunction.
The exclusive or is very clear in meaning when trying to eliminate the true/false states of various operands in the conditional expression. The expression using an exclusive or is true if and only if one operand is true and the other is false, assuming two operands are participating in the expression.
In considering a chain of operands participating in an expression with exclusive or conditional operators, for example x XOR y XOR z...XOR n. Here the output of the entire expression is true if an odd number of operands are resulting true. Conversely, the entire output of the expression is false if even numbers of operands are resulting true. In simple terms, exclusive or means that one or the other must be true, but both cannot be true and both cannot be false.