OR

The disjunction operation - true when at least one input is true, equivalent to clamped addition in binary arithmetic.

12 topics • ~867 words

Either path reaches the reservoir. You trace both routes on the yellowed diagram. Does not matter which one. Any path that works, works.

Of the four possible input combinations (TT, TF, FT, FF), OR returns true for three of them—only FF gives false. That is 3 out of 4, the most permissive binary operation. AND is the opposite: only 1 out of 4.

The OR Operation

The OR operation (also called disjunction) combines two truth values.

It returns true when at least one input is true. OR only returns false when both inputs are false.

Think of it as a lenient check: if either condition passes, the result is true.

OR Notation

The OR operation is written in several ways:

  • $\lor$ (vee) - formal logic notation: P $\lor$ Q
  • || - programming (C, Java, JavaScript): p || q
  • + - Boolean algebra: P + Q
  • OR - written out: P OR Q

The $\lor$ symbol looks like a "V" - think "V for Vel" (Latin for "or").

OR as Addition

When we represent True as 1 and False as 0, OR behaves almost like addition - but with a twist: the result is clamped to a maximum of 1.

A B A + B Clamped A OR B
0 0 0 0 0
0 1 1 1 1
1 0 1 1 1
1 1 2 1 1

This is why Boolean algebra uses + for OR. The key difference from regular addition: 1 + 1 = 1, not 2. Any positive sum becomes 1.

Evaluating OR

To evaluate OR, remember the rule: OR returns true when at least one input is true. It only returns false when both inputs are false.

Symbolic OR Evaluation

When evaluating symbolic expressions like {{leftVar}} $\lor$ {{rightVar}}, we substitute the given values and apply the OR rule.

The OR Truth Table

Like AND, the OR truth table has four rows:

P Q P $\lor$ Q
T T T
T F T
F T T
F F F

Notice: only one row produces False - when both inputs are False.

This is the opposite pattern from AND!

Reading the OR Truth Table

The OR truth table:

P Q P $\lor$ Q
T T T
T F T
F T T
F F F

To find the result, locate the row matching your input values.

English to Logic (OR)

In English, OR is expressed in several ways:

  • "X or Y"
  • "Either X or Y"
  • "X or else Y"
  • "At least one of X or Y"

Note: In logic, "or" is inclusive - "A or B" is true even when both are true.

This differs from everyday English where "or" sometimes means "one but not both."

Logic to English (OR)

We can translate from logical notation back to English. When you see P $\lor$ Q, you can read it as "P or Q" or "either P or Q."

Remember: In logic, OR is inclusive - "P or Q" includes the case where both P and Q are true.

OR with Multiple Operands

OR can be extended to more than two operands. The result is true if at least one operand is true:

  • P $\lor$ Q $\lor$ R is true when any of P, Q, or R is true
  • The result is false only when all operands are false

This works because OR is associative: (P $\lor$ Q) $\lor$ R = P $\lor$ (Q $\lor$ R).

Inclusive vs Exclusive OR

In Boolean logic, OR is inclusive: P $\lor$ Q is true when P is true, Q is true, or both are true.

In everyday English, "or" is often exclusive: "Would you like coffee or tea?" usually implies you'll pick one, not both.

P Q Inclusive OR ($\lor$) Exclusive OR ($\oplus$)
T T T F
T F T T
F T T T
F F F F

XOR (exclusive or) is covered in detail later.

OR Short-Circuit Evaluation

You find an open path and stop tracing. One working route is all you need. No point checking the backup lines.

When evaluating P $\lor$ Q, if P is true, we already know the result must be true - there's no need to evaluate Q. This is short-circuit evaluation for OR.

OR short-circuits on true because true $\lor$ anything = true.

Compare with AND, which short-circuits on false.

Ready to test your understanding?

Bitwit uses spaced repetition to help you truly master concepts like this—not just read about them. Each card generates with different values, so you can't just memorize answers.

Practice OR →