WOLFRAM

e1||e2||

is the logical OR function. It evaluates its arguments in order, giving True immediately if any of them are True, and False if they are all False.

Details

  • Or[e1,e2,] can be input in StandardForm and InputForm as e_(1)∨e_(2)∨.... The character ∨ can be entered as ||, or, or \[Or].
  • Or has attribute HoldAll, and explicitly controls the evaluation of its arguments. In e_(1)||e_(2)||... the e_(i) are evaluated in order, stopping if any of them are found to be True.
  • Or gives symbolic results when necessary, removing initial arguments that are False.

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Combine assertions with ||:

Out[1]=1

A symbolic disjunction:

Out[1]=1

A system of equations:

Out[1]=1

Enter using or:

Out[1]=1

Scope  (5)Survey of the scope of standard use cases

Or works with any number of arguments:

Out[1]=1

Or is associative:

Or with explicit True or False arguments will simplify:

Out[1]=1
Out[2]=2

Or evaluates its arguments in order, stopping when an argument evaluates to True:

Out[1]=1
Out[2]=2

The order of arguments may be important:

Out[3]=3
Out[4]=4

Symbolic transformations will not preserve argument ordering:

Out[1]=1
Out[2]=2

TraditionalForm formatting:

Applications  (6)Sample problems that can be solved with this function

Combine conditions in a Wolfram Language program:

Out[2]=2

If an argument of Or evaluates to True, any subsequent arguments are not evaluated:

Out[3]=3

The argument order in Or matters; if the last two arguments are reversed, I0 is evaluated:

Out[5]=5

Combine assumptions:

Out[1]=1

Combine equations and inequalities; Or is used both in the input and the output:

Out[1]=1

Use || to combine conditions:

Out[1]=1
Out[2]=2

A cellular automaton based on Or:

Out[1]=1

Find the area of the union of sets given by algebraic conditions:

Out[1]=1

This shows the set:

Out[2]=2

Properties & Relations  (7)Properties of the function, and connections to other functions

Truth table for binary Or:

Out[1]=1

Ternary Or:

Out[2]=2

Zero-argument Or is False:

Out[1]=1

Or with a single argument will return the evaluated argument regardless of value:

Out[1]=1

&& has higher precedence than ||:

Use BooleanConvert to expand And with respect to Or:

Out[1]=1
Out[2]=2

De Morgan's laws relate And, Or, and Not:

Out[1]=1
Out[2]=2

Disjunction of conditions corresponds to the Max of Boole functions:

Out[1]=1
Out[2]=2
Wolfram Research (1988), Or, Wolfram Language function, https://reference.wolfram.com/language/ref/Or.html (updated 1996).
Wolfram Research (1988), Or, Wolfram Language function, https://reference.wolfram.com/language/ref/Or.html (updated 1996).

Text

Wolfram Research (1988), Or, Wolfram Language function, https://reference.wolfram.com/language/ref/Or.html (updated 1996).

Wolfram Research (1988), Or, Wolfram Language function, https://reference.wolfram.com/language/ref/Or.html (updated 1996).

CMS

Wolfram Language. 1988. "Or." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/Or.html.

Wolfram Language. 1988. "Or." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/Or.html.

APA

Wolfram Language. (1988). Or. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Or.html

Wolfram Language. (1988). Or. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Or.html

BibTeX

@misc{reference.wolfram_2025_or, author="Wolfram Research", title="{Or}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/Or.html}", note=[Accessed: 21-June-2025 ]}

@misc{reference.wolfram_2025_or, author="Wolfram Research", title="{Or}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/Or.html}", note=[Accessed: 21-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_or, organization={Wolfram Research}, title={Or}, year={1996}, url={https://reference.wolfram.com/language/ref/Or.html}, note=[Accessed: 21-June-2025 ]}

@online{reference.wolfram_2025_or, organization={Wolfram Research}, title={Or}, year={1996}, url={https://reference.wolfram.com/language/ref/Or.html}, note=[Accessed: 21-June-2025 ]}