Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Discrete Mathematics > Boolean Computation >
Mathematica > Mathematics and Algorithms > Logic & Boolean Algebra > Boolean Computation >

Or (||, Or)

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.
  • 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 is found to be True.
  • Or gives symbolic results when necessary, removing initial arguments that are False.
Combine assertions with ||:
A symbolic disjunction:
A system of equations:
Enter using Esc or Esc:
Combine assertions with ||:
In[1]:=
Click for copyable input
Out[1]=
 
A symbolic disjunction:
In[1]:=
Click for copyable input
Out[1]=
 
A system of equations:
In[1]:=
Click for copyable input
Out[1]=
 
Enter using Esc or Esc:
In[1]:=
Click for copyable input
Out[1]=
Or works with any number of arguments:
Or is associative:
Or with explicit True or False arguments will simplify:
Or evaluates its arguments in order, stopping when an argument evaluates to True:
The order of arguments may be important:
Symbolic transformations will not preserve argument ordering:
TraditionalForm formatting:
Combine conditions in Mathematica code:
If an argument of Or evaluates to True, any subsequent arguments are not evaluated:
The argument order in Or matters; if the last two arguments are reversed, I≥0 is evaluated:
Combine assumptions:
Combine equations and inequalities; Or is used both in the input and the output:
Use || to combine conditions:
A cellular automaton based on Or:
Find the area of the union of sets given by algebraic conditions:
This shows the set:
Truth table for Or:
&& has higher precedence than ||:
Use BooleanConvert to expand And with respect to Or:
De Morgan's laws relate And, Or and Not:
Disjunction of conditions corresponds to the Max of Boole functions:
New in 1 | Last modified in 3
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team