You can use Array.delete_at(0) method which will delete first element.
x = [2,3,4,11,0]
x.delete_at(0) unless x.empty? # [3,4,11,0]
2
votes
You can use:
a.delete(a[0])
a.delete_at 0
Both can work
2
votes
You can use:
arr - [arr[0]]
or
arr - [arr.shift]
or simply
arr.shift(1)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more