So I have just (accidentally) discovered that Ruby allows the following Syntax:
if foo and bar
or
if foo or bar
.
How (if at all?) is this different from
if foo && bar
if foo || bar
Are the operators different? How?
So I have just (accidentally) discovered that Ruby allows the following Syntax:
if foo and bar
or
if foo or bar
.
How (if at all?) is this different from
if foo && bar
if foo || bar
Are the operators different? How?
Are the operators different?
Yes they are as per the operator precedence.
How?
For more information see Difference between “and” and && in Ruby?
and Difference between “or” and || in Ruby?