Skip to content

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

instance method

Enumerable#drop

enum.drop(n) → array

Drops first n elements from enum, and returns rest elements in an array.

Example
a = [1, 2, 3, 4, 5, 0]
a.drop(3)             #=> [4, 5, 0]
See also #detect #drop_while #cycle #each_cons also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1