This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

shift

        # Array.shift

(from ruby core)
---
    array.shift -> object or nil
    array.shift(n) -> new_array

---

Removes and returns leading elements.

When no argument is given, removes and returns the first element:
    a = [:foo, 'bar', 2]
    a.shift # => :foo
    a # => ['bar', 2]

Returns `nil` if `self` is empty.

When positive Integer argument `n` is given, removes the first `n`
elements; returns those elements in a new Array:
    a = [:foo, 'bar', 2]
    a.shift(2) # => [:foo, 'bar']
    a # => [2]

If `n` is as large as or larger than `self.length`, removes all
elements; returns those elements in a new Array:
    a = [:foo, 'bar', 2]
    a.shift(3) # => [:foo, 'bar', 2]

If `n` is zero, returns a new empty Array; `self` is unmodified.

Related: #push, #pop, #unshift.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.