We saw in Keywords that
nil are keywords in Ruby.
false are the two Boolean values, and they
represent truth and falsehood, yes and no, on and off.
nil is a special value reserved to indicate
the absence of value.
Each of these keywords evaluates to a special object.
true evaluates to an object that is a
singleton instance of
nil are singleton instances of
NilClass. Note that there is no
Boolean class in Ruby.
FalseClass both have
Object as their superclass.
If you want to check whether a value is
nil, you can simply compare it to
nil, or use the method
o == nil # Is o nil? o.nil? # Another way to test
nil refer to objects, not numbers.
nil are not the same thing as
is not the same thing as
1. When Ruby
requires a Boolean value,
false, and any value other than
false behaves like