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

前端 未结 5 1091
小蘑菇
小蘑菇 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 12:11

    They have very low precedence so that the operands don't have to be wrapped in parentheses, as is sometimes the case with && and ||.

提交回复
热议问题