Pike v8.1 release 6

Method Array.shift()


Method shift

array shift(array list)

Description

Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down. If there are no elements in the array it returns 0. Returns an array where the first element is the shifted value and the second element is the modified array.

Example

Array.shift(({ "a", "b", "c", "d"})); > ({ "a", ({ "b", "c", "d" }) })

See also

ADT.Stack