This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Programming / Logical Operations  /
Xor

  • Xor[ , , ... ] is the logical XOR (exclusive OR) function.
  • It gives True if an odd number of the are True, and the rest are False. It gives False if an even number of the are True, and the rest are False.
  • Xor gives symbolic results when necessary, and applies various simplification rules to them.
  • Unlike And and Or, Xor is not a control structure, and does not have attribute HoldAll.
  • See the Mathematica book: Section 1.5.6.
  • See also: LogicalExpand.

    Further Examples

    An odd number of occurences of True makes Xor True; an even number makes it False.

    In[1]:=

    Out[1]=

    In[2]:=

    Out[2]=

    In[3]:=

    Out[3]=

    In[4]:=

    Out[4]=

    In[5]:=

    Out[5]=

    In[6]:=

    Out[6]=