routine pop
1 | role Buf |
1.1 | (Buf) method pop |
2 | class Array |
2.1 | (Array) routine pop |
Documentation for routine pop
assembled from the following types:
role Buf
From Buf
(Buf) method pop
method pop()
Extracts the last element of the buffer
say .pop(); # OUTPUT: «8»say .perl; # OUTPUT: «Buf.new(1,1,2,3,5)»
class Array
From Array
(Array) routine pop
Defined as:
multi sub pop(Array )multi method pop(Array:)
Removes and returns the last item from the array. Fails for an empty array.
Example:
my = <a b>; # a b.pop; # bpop ; # apop ;CATCH ;# OUTPUT: «X::Cannot::Empty: Cannot pop from an empty Array»