Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Range#end

self.end → object

Returns the object that defines the end of self.

Example
(1..4).end  # => 4
(1...4).end # => 4
(1..).end   # => nil

Related: Range#begin, Range#last.

See also #each #entries #cover? #eql? also in 4.0 · 3.4 · 3.3 · 3.2 · 3.0