mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 15:24:09 +03:00
Fix explanation of "and" and "or" in ruby.
This commit is contained in:
parent
e191446b33
commit
7070304d60
@ -79,10 +79,14 @@ true && false #=> false
|
|||||||
true || false #=> true
|
true || false #=> true
|
||||||
!true #=> false
|
!true #=> false
|
||||||
|
|
||||||
# Alternate spellings of logical operators
|
# There are alternate versions of the logical operators with much lower
|
||||||
true and false #=> false
|
# precedence. These are meant to be used as flow-control constructs to chain
|
||||||
true or false #=> true
|
# statements together until one of them returns true or false.
|
||||||
not true #=> 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
|
# Strings are objects
|
||||||
|
Loading…
Reference in New Issue
Block a user