diff options
author | Geoff Liu <g@geoffliu.me> | 2015-06-16 12:54:54 -0600 |
---|---|---|
committer | Geoff Liu <g@geoffliu.me> | 2015-06-16 12:54:54 -0600 |
commit | 7070304d60715405bb5f2432f4c84868a6418376 (patch) | |
tree | 960abfd60af8be2f315b7e8c1c944e3ed7a4b07a /ruby.html.markdown | |
parent | e191446b333856afff0456349edb71da9634f6aa (diff) |
Fix explanation of "and" and "or" in ruby.
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r-- | ruby.html.markdown | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown index 792c9c95..66a0774d 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -79,10 +79,14 @@ true && false #=> false true || false #=> true !true #=> false -# Alternate spellings of logical operators -true and false #=> false -true or false #=> true -not true #=> false +# There are alternate versions of the logical operators with much lower +# precedence. These are meant to be used as flow-control constructs to chain +# statements together until one of them returns true or false. + +# `do_something_else` only called if `do_something` succeeds. +do_something() and do_something_else() +# `log_error` only called if `do_something` fails. +do_something() or log_error() # Strings are objects |