3 ms·
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/
by jeltz 15y 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 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!
- 286c8cb04bda 15y agoI'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?"
- jeltz 15y agoAgreed, it is not my example.