Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » operators » xor
next | previous | forward | backward | up | index | toc

# xor -- exclusive disjunction

- Usage:
    `t xor u`
- Inputs:
  - t, a Boolean value or a function,
  - u, a Boolean value or a function,
- Outputs:
  - a Boolean value or a function,

## Description

If `t` and `u` are booleans, then `t xor u` returns true if exactly one of them is true.

    i1 : even 7 xor isPrime 7

    o1 = true

If they are both functions than return booleans, then the return value is also a function.

    i2 : isEvenXorPrime = even xor isPrime

    o2 = isEvenXorPrime

    o2 : FunctionClosure

    i3 : isEvenXorPrime 7

    o3 = true

    i4 : isEvenXorPrime 2

    o4 = false

## See also

- and -- conjunction
- or -- disjunction
- not -- negation

## Ways to use symbol xor:

- `Boolean xor Boolean`
- `Function xor Function`

## For the programmer

The object xor is a keyword.

This operator may be used as a binary operator in an expression like x xor y. The user may install binary methods for handling such expressions with code such as

             X  xor  Y := (x,y) -> ...

where X is the class of x and Y is the class of y.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/operators.m2:428:0.