-1

In ruby, and is the same as &&, but why does and have lower precedence?

false and false || true # => false
false && false || true # => true
Matt
  • 13,577
  • 6
  • 43
  • 67
feng ce
  • 734
  • 1
  • 7
  • 21

1 Answers1

4

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 and or are control flow operators, not boolean operators.

Jörg W Mittag
  • 351,196
  • 74
  • 424
  • 630
Matt
  • 13,577
  • 6
  • 43
  • 67