Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我刚刚(偶然地)发现Ruby允许以下语法:
if foo and bar
或者
if foo or bar.
if foo or bar
这与(如果有的话)有何不同
if foo && bar
if foo || bar
运营商不一样吗?如何?
运营商不一样吗?
是的,它们按照运算符的优先级。
如何?
有关更多信息,请参阅Difference between “and” and && in Ruby?和Difference between “or” and || in Ruby?
Difference between “and” and && in Ruby?
Difference between “or” and || in Ruby?