or

x or y

or(x, y)

Try it yourself:

See also:

or: combine logical conditions

or(a, b) is true when at least one condition is true. It expresses alternatives such as “the value is missing or negative” in a readable rule.

Truth-table idea

Only false OR false is false. All other combinations are true. This is logical OR, distinct from bitOr(), which combines integer bits.

Build validation rules

Combine it with and, not, and equal. Predicates such as isNegative() and isZero() make conditions clear.

Caveat

Use parentheses in longer expressions so that the intended precedence is obvious, especially when AND and OR are mixed.

Try Or in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions