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

Enumerator::ArithmeticSequence#last

aseq.last → num or nil
aseq.last(n) → an_array

Returns the last number in this arithmetic sequence, or an array of the last n elements.

See also #inspect #size #hash #step also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0