Disjunction and conjunction in words (or
, and
) in argument position require additional parentheses, as opposed to ||
, &&
.
def foo _; end
foo(1 || 2) # => Good
foo(1 or 2) # => Syntax error
foo((1 or 2)) # => Good
foo(1 && 2) # => Good
foo(1 and 2) # => Syntax error
foo((1 and 2)) # => Good
Why do they need additional parentheses?