This blog is part of our Ruby 2.7 series.
Ruby 2.7.0 was released on Dec 25, 2019.
Ruby 2.7 added support for
which makes the start of range an optional parameter.
(..100) is a Beginless Range and it is equivalent to
Let’s see how Beginless Range could be used.
Here is another example where
case statement the condition can be read as
below the specified level.
It can also be used for defining constants for ranges.
Using Beginless Range in DSL makes it easier to write conditions and it looks more natural.
Here is the relevant
regarding this change.