Ruby && and = operators misudnerstanding
问题 What do you think would be the result of the next expression in Ruby? a = 10 && b = 25 Try to calculate in the ming and only then use irb . So, if we take a look at the Ruby documentation about Operators Precedence then we will se that && operator has a higher priority than = . So you must think that Ruby will evaluate the expression in the next way: a = ((10 && b) = 25) But Ruby does a job in another way: a = (10 && (b = 25)) # => 25 So, the priority of the = in b = 25 is higher, then && .