shift() public

Removes a key-value pair from hsh and returns it as the two-item array [ key, value ], or the hash’s default value if the hash is empty.

   h = { 1 => "a", 2 => "b", 3 => "c" }
   h.shift   #=> [1, "a"]
   h         #=> {2=>"b", 3=>"c"}
Show source
Register or log in to add new notes.