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

Written byAkshay Vishnoi
Related blogs
- 01Ruby 2.4 has optimized enumerable min max methodsSeptember 28, 2017 · Chirag Shah
- 02CSV::Row#each etc. return enumerator when no block givenSeptember 25, 2017 · Sushant Mittal
- 03Ruby 2.4 DateTime#to_time & Time#to_time keeps infoSeptember 19, 2017 · Sushant Mittal
- 04Avoid exception for dup on IntegerAugust 1, 2017 · Rohit Arolkar