“and” vs && and “or” vs || in Ruby
If you use Ruby long enough, you will discover the
and
andor
operators. These appear at first glance to be synonyms for&&
and||
. You will then be tempted to use these English oprators in place of&&
and||
, for the sake of improved readability. Assuming you yield to that temptation, you will eventually find yourself rudely surprised thatand
andor
don’t behave quite like their symbolic kin...
Avdi Grimm
Avdi Grimm presents a concise guide to a matter that confuses the majority of Ruby developers from time to time.