ruby中,and与&&是有区别的,而且不在“短路”运算上。看
例子:
class="ruby">
puts true and false
puts (true and false)
puts true && false
puts true & false
////~>
true
false
false
false
翻资料
发现ruby1.8.7有这么个说法:
引用
Use &&/|| for boolean
expressions, and/or for control flow. (Rule of thumb: If you have to use outer parentheses, you are using the wrong operators.)