“and” and “or” use versus “&&” and “||” in ruby
A natural inclination when one starts programming in Ruby is to use “and” and “or” instead of the “&&” and “||” to increase readability. However, “and” is not a drop in syntactic synonym with “&&” and the same goes for “or”.
James pointed out a good blog post that explains the issues around order of precedence with these operators:
http://blog.jayfields.com/2007/08/ruby-operator-precedence-of-and-which.html
It’s worth reading the comments.
It should also be noted that the Ruby on Rails source style guide has a preference for “&&” and “||”:
http://rails.lighthouseapp.com/projects/8994/source-style

