'Or' is a conjunction that indicates that at least two things are possible: "apples or oranges" indicates that you have a choice of having an apple, and a choice of having an orange. It is a common logical operator in logic systems.

In the weak (or inclusive) sense, 'or' is used to indicate that at least one, and perhaps more, of the given options could be. ("Do you want an apple or an orange?" could be answered "an apple", "an orange", or "both!") For clarification, sometimes 'and/or' is used.

In the strong sense (AKA the exclusive or, xor), 'or' means that there are two possibilities, only one of which can be ("It will be 10 or 15 minutes.").

In symbolic logic, 'or' is used in the weak sense, and is called a disjunction. It is symbolized by a lowercase 'v' (or ∨ if your browser supports it) called a wedge or a vee. This is an abbreviation of the Latin word for the weak sense of 'or', vel. (Latin also had a word for the strong sense, aut).

If you want to use the strong sense of 'or' in symbolic logic, you have to go the long way around;
(p or q) and not (p and q).
(p ∨ q) ∧ ~(pq)
Where ~ stands for 'negation' (standard symbol) and ∧ stands for 'and' (in symbolic logic, a bullet point is often used, but this upside-down arrow is also common).

"or" is a reserved word in the programming language Lua.

In the BNF syntax of Lua, it appears as a terminal atom in one substitution rule:
binopor
"binop" appears as a nonterminal atom in one substitution rule:
expexp binop exp

"or" is the disjunctive binary logical operator. Like the control structures, all logical operators consider "nil" as false and anything else as true. The disjunction operator "or" returns its first argument if it is different from "nil"; otherwise, it returns its second argument. (Both "and" and "or" use short-cut evaluation, that is, the second operand is evaluated only if necessary.)

There are two useful Lua idioms that use the logical operator "or". The first idiom is
x = x or v
which is equivalent to
if x == nil then x = v end
This idiom sets x to a default value v when x is not set.

The second idiom is
x = a and b or c
which should be read as x = (a and b) or c. This idiom is equivalent to
if a then x = b else x = c end
provided that b is not "nil".


Other systems do not use short-cut evaluation (a limited form of lazy evaluation), and both operands are always evaluated fully before the result of the "or" operation is determined. Yet other systems, nondeterministic systems, usually found in parallel processing environments, guarantee that the result of the "or" operation is logically correct, but does not guarantee that both operands are fully evaluated, it does not guarantee that either one in particular is evaluated (Lua guarantees that the first operand is evaluated), and it does not guarantee that an operand will not be only partially evaluated (Lua guarantees that the second operand will either be evaluated or not, with no in-between). Using impure functions or expressions with side-effects in nondeterministic systems is therefore considered harmful.

And, in other programming languages, the "or" keyword can have another meaning: a bitwise "or" on two numeric (usually unsigned integer) operands (giving another number, of the same type, as a result). A number may be considered an array of bits; in Eindhoven notation, any number (b) may be expressed as (+ : iZ : bi * 2i) - standard binary notation - each bi being either 0 or 1, thus making an array of bits. (For signed values, the sign bit is considered just another bit in the array; for integers, negative values of i need not be considered.) The "numeric or" performs the "logical or" operation on bits in corresponding positions in the two operands, and places the result of each "logical or" in the corresponding position in the result. In symbols, "b or c" evaluates to (+ : iZ : (bi or ci) * 2i).

The C symbol for "logical or" is || and the C symbol for "numeric or" is |.

Or (?), conj. [OE. or, outher, other, auther, either, or, AS. awer, contr. from ahwaeer; a aye + hwaeer whether. See Aye, and Whether, and cf. Either.]

A particle that marks an alternative; as, you may read or may write, -- that is, you may do one of the things at your pleasure, but not both. It corresponds to either. You may ride either to London or to Windsor. It often connects a series of words or propositions, presenting a choice of either; as, he may study law, or medicine, or divinity, or he may enter into trade.

If man's convenience, health, Or safety interfere, his rights and claims Are paramount. Cowper.

Or may be used to join as alternatives terms expressing unlike things or ideas (as, is the orange sour or sweet?), or different terms expressing the same thing or idea; as, this is a sphere, or globe.

Or sometimes begins a sentence. In this case it expresses an alternative or subjoins a clause differing from the foregoing. "Or what man is there of you, who, if his son shall ask him for a loaf, will give him a stone?" Matt. vii. 9 (Rev. Ver. ).

Or for either is archaic or poetic.

Maugre thine heed, thou must for indigence Or steal, or beg, or borrow thy dispence. Chaucer.

 

© Webster 1913.


Or, prep. & adv. [AS. r ere, before. &root;204. See Ere, prep. & adv.]

Ere; before; sooner than.

[Obs.]

But natheless, while I have time and space, Or that I forther in this tale pace. Chaucer.

Or ever, Or ere. See under Ever, and Ere.

 

© Webster 1913.


Or, n. [F., fr. L. aurum gold. Cf. Aureate.] Her.

Yellow or gold color, -- represented in drawing or engraving by small dots.

 

© Webster 1913.

Log in or register to write something here or to contact authors.