
Issue #20487 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Rejected This is expected behavior. `nil` is the implicit end of an endless range: ```ruby (1..) == (1..nil) # => true (1..nil) # => 1.. (1..).end # => nil ``` ---------------------------------------- Bug #20487: 1..nil is giving range from 1 to inifinity in ruby greater than 2.6 https://bugs.ruby-lang.org/issues/20487#change-108270 * Author: akshay_kakade (Akshay Kakade) * Status: Rejected * ruby -v: 3.2.0 * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- we consider nil as undefined value, value that is not present, we consider nil as falsey value as well, when we do nil.to_i it gives us zero..then with this rational 1..nil shouldn't give the range 1 to infinity, either we should make it as invalid or it should be converted to 1..0 script: (1..nil).each {|n| puts n } output 1 2 3 4 5 6 7 . . . . infinity -- https://bugs.ruby-lang.org/