June 19, 2017
This blog is part of our Ruby 2.4 series.
Ruby has top level constants like TRUE
, FALSE
and NIL
. These constants are
just synonyms for true
, false
and nil
respectively.
In Ruby 2.4, these constants are deprecated and will be removed in future version.
# Ruby 2.3
2.3.1 :001 > TRUE
=> true
2.3.1 :002 > FALSE
=> false
2.3.1 :003 > NIL
=> nil
# Ruby 2.4
2.4.0 :001 > TRUE
(irb):1: warning: constant ::TRUE is deprecated
=> true
2.4.0 :002 > FALSE
(irb):2: warning: constant ::FALSE is deprecated
=> false
2.4.0 :003 > NIL
(irb):3: warning: constant ::NIL is deprecated
=> nil
If this blog was helpful, check out our full blog archive.