Mathematica 9 is now available
 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]=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.