所以我(偶然)发现Ruby允许以下语法:
if foo and bar
或
if foo or bar
。
如何(如果有的话)与
不同 if foo && bar
if foo || bar
运营商与众不同吗?怎么样?
答案 0 :(得分:3)
运营商与众不同吗?
是的,它们符合运算符优先级。
如何?
有关详细信息,请参阅Difference between “and” and && in Ruby?
和Difference between “or” and || in Ruby?