shift multimethod

Methods

shift(arr:Arr)
Get the first element and remove it from the array. Throws EmptyArrayFail if there are no elements in the array.

Returns

Any
shift(arr:Arr, dflt:Any)
Get the first element and remove it from the array. Returns dlft if there are no elements in the array.

Returns

Any
shift(h:Hash, k:Any) Source: stdlib.ngs:2778
Get the given key from a Hash and remove it from the Hash. Underlying h[k] may throw KeyNotFound.

Example

h = {"a": 1}
s = h.shift("a")  # h == {} and s == 1
shift(h:Hash, k:Any, dflt:Any) Source: stdlib.ngs:2788
Get a key from a Hash and remove it from the Hash. If they key is not in the Hash, return dflt

Example

h = {}
h.shift("a", 7)  # 7