AND & OR Operators Precedence
Are you still sure that &&
and and
is the same operators? Look at this:
a = true && false
a
=> false
a = true and false
a
=> true
The same situation could be reproduced for ||
and or
. Why? The answer lies in Ruby Operator Precedence.
The first example can be represented as:
a = (true && false)
Second:
(a = true) and false
Discover More Reads
Categories: