In ruby, and
is the same as &&
, but why does and
have lower precedence?
false and false || true # => false
false && false || true # => true
In ruby, and
is the same as &&
, but why does and
have lower precedence?
false and false || true # => false
false && false || true # => true
You're absolutely correct that the humanised operators have lower precedence. There is an excellent (and brief!) article on this here if you want more information.
Simplest answer (from that article):
Properly understood,
and
andor
are control flow operators, not boolean operators.