mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-23 14:17:02 +03:00
Merge pull request #1145 from geoffliu/master
[Ruby/en] Fix explanation of "and" and "or"
This commit is contained in:
commit
ce9a5af88b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user