-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,948
  • 6
  • 44
  • 68
fcce
  • 1,034
  • 1
  • 12
  • 24

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
  • 363,080
  • 75
  • 446
  • 653
Matt
  • 13,948
  • 6
  • 44
  • 68