Ruby 2.4 deprecated constants TRUE, FALSE & NIL

Akshay Vishnoi

Akshay Vishnoi

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.

1# Ruby 2.3
2
32.3.1 :001 > TRUE
4 => true
52.3.1 :002 > FALSE
6 => false
72.3.1 :003 > NIL
8 => nil
1# Ruby 2.4
2
32.4.0 :001 > TRUE
4(irb):1: warning: constant ::TRUE is deprecated
5 => true
62.4.0 :002 > FALSE
7(irb):2: warning: constant ::FALSE is deprecated
8 => false
92.4.0 :003 > NIL
10(irb):3: warning: constant ::NIL is deprecated
11 => nil

If this blog was helpful, check out our full blog archive.

Stay up to date with our blogs.

Subscribe to receive email notifications for new blog posts.