Ruby 2.4 deprecated constants TRUE, FALSE & NIL

Akshay Vishnoi

By Akshay Vishnoi

on 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

Stay up to date with our blogs. Sign up for our newsletter.

We write about Ruby on Rails, ReactJS, React Native, remote work,open source, engineering & design.