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

# or -- disjunction

- Usage:
    `t or 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` or `u` are booleans, then `t or u` returns true if either is true.

    i1 : even 7 or isPrime 7

    o1 = true

If `t` is true, then the code in `u` is not evaluated.

    i2 : even 6 or 1/0

    o2 = true

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

    i3 : isEvenOrPrime = even or isPrime

    o3 = isEvenOrPrime

    o3 : FunctionClosure

    i4 : isEvenOrPrime 7

    o4 = true

    i5 : isEvenOrPrime 9

    o5 = false

## See also

- and -- conjunction
- not -- negation
- xor -- exclusive disjunction

## Ways to use symbol or:

- `Boolean or Boolean`
- `Function or Function`

## For the programmer

The object or is a keyword.

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

             X  or  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:294:0.