How to use Ruby’s English and/or operators without going nuts
Apparently I wasn’t programming ruby the right way. I actually enjoyed the and
and or
statements, even in if-statements, and preferr them over the more classical programming constructs of &&
and ||
… but this article explains the ‘right’ way:
- use
and
andor
for control (e.g. do this and that, or this or that) - use
&&
and||
for boolean checks (e.g. if this is true and that is true)
But on the other hand, hey, both works, do what you like. Ruby is a friend, not a compiler.