sub pop

Documentation for sub pop, assembled from the following types:

class Array

From Array

(Array) routine pop

Defined as:

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

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

Example:

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