Documentation for sub shift

Documentation for sub shift, assembled from the following types:

class Array

From Array

(Array) routine shift

Defined as:

multi sub    shift(Array:D )
multi method shift(Array:D:)

Removes and returns the first item from the array. Fails for an empty arrays.

Example:

my @foo = <a b>;
say @foo.shift;             # OUTPUT: «a␤» 
say @foo.shift;             # OUTPUT: «b␤» 
say @foo.shift;
CATCH { default { put .^name''.Str } };
# OUTPUT: «X::Cannot::Empty: Cannot shift from an empty Array␤»