In logic and mathematics, or, also known as logical disjunction or inclusive disjunction is a logical operator that results in true whenever one or more of its operands are true. In grammar, or is a coordinating conjunction. In ordinary language "or" rather has the meaning of exclusive disjunction.
Logical disjunction is an operation on two logical values, typically the values of two propositions, that produces a value of false if and only if both of its operands are false. More generally a disjunction is a logical formula that can have one or more literals separated only by ORs. A single literal is often considered to be a degenerate disjunction.
The following properties apply to disjunction:
The mathematical symbol for logical disjunction varies in the literature. In addition to the word "or", the symbol "", deriving from the Latin word vel for "or", is commonly used for disjunction. For example: "A B " is read as "A or B ". Such a disjunction is false if both A and B are false. In all other cases it is true.
All of the following are disjunctions:
The corresponding operation in set theory is the set-theoretic union.
or operator can be used to set bits in a bitfield to 1, by
or-ing the field with a constant field with the relevant bits set to 1.
|) and logical disjunction with the double pipe (
Logical disjunction is usually short-circuited; that is, if the first (left) operand evaluates to
true then the second (right) operand is not evaluated. The logical disjunction operator thus usually constitutes a sequence point.
Although in most languages the type of a logical disjunction expression is boolean and thus can only have the value