Last Updated: February 25, 2016
·
435
· mejarc

Ruby's equivalent to Python's `ary[1:]`

Given an Array foo, return a sub-array, starting with a given index and going to the end of foo.

foo = [1, 2, 3, 4]

Python:

foo[1:]  # [2, 3, 4]

Ruby:

foo.drop(1) # [2, 3, 4]