Information Technology Reference
In-Depth Information
<<METHOD_DESCRIPTION
This is a multiline string.
All the whitespace is preserved, and I can even apply #{interpolation} inside
this block.
METHOD_DESCRIPTION
True and False
In addition to the literal true and false , Ruby supports “truthy” and “falsey” values. Ex-
pressions evaluate as true or false in a situation where a boolean result is expected (such as
when they are used in conditionals like the if statement). Table 3-1 demonstrates the com-
mon truthy and falsey values and their actual evaluations.
Table 3-1. Truthy and falsey values
value
evaluates as
true
true
false
false
Bacon
true
Object
true
0
true
1
true
-1
true
nil
false
""
true
[]
true
{}
true
Search WWH ::




Custom Search