Skip to content
☈king edited this page Nov 19, 2012 · 4 revisions

Boolean disjunction.

Evaluates to true if either its left or right side are true.

Remember that the 'or' operator is lower precedence operator than '||', so

an_expression or another_expression is roughly equivalent to: (an_expression) || (another_expression)

Truth table

true or true ⇒ true false or true ⇒ true false or false ⇒ false

Precedence

true or false ? 'yes' : 'no' ⇒ true true || false ? 'yes' : 'no' ⇒ "yes"

See http://phrogz.net/ProgrammingRuby/language.html#table_18.4

Clone this wiki locally