Is there any wisdom behind “and”, “or” operators in Ruby?

前端 未结 5 1083
小蘑菇
小蘑菇 2020-11-29 11:21

I wonder why ruby give and, or less precedence than &&, || , and assign operator? Is there any reason?

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 11:57

    I believe the idea is specifically to get them below the assignment operators, so you can write logic tests with assignments but without parens.

提交回复
热议问题