Hacker News new | ask | show | jobs
by jeltz 5190 days ago
Indeed, "and" and "or" are excellent for their intended use, for control flow. Like explained by the style guide the Github one is based on. https://github.com/bbatsov/ruby-style-guide

   # boolean expression
   if some_condition && some_other_condition
     do_something
   end

   # control flow
   document.saved? or document.save!
1 comments

I'm not sold on tossing "and" and "or" out the window, but wouldn't "document.saved? or document.save!" read better as "document.save! unless document.saved?"
Agreed, it is not my example.