diff options
author | ven <vendethiel@hotmail.fr> | 2015-06-16 21:58:08 +0200 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2015-06-16 21:58:08 +0200 |
commit | ce9a5af88b75c0308d4951e57eac78f4658598ed (patch) | |
tree | fb18c44e2692e397e7937c96c65079b40b7ee79b | |
parent | e31b9e90c9bddda007f7b9a30aab0263443e9212 (diff) | |
parent | a6af51e42f6eef190fe8bdc602a7c07f040d4f5e (diff) |
Merge pull request #1145 from geoffliu/master
[Ruby/en] Fix explanation of "and" and "or"
-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 |