txt: ## pop.md
  pop
  
  Combined from primary sources listed below.
  
  # [In role Buf](#___top "go to top of document")[§](#(role_Buf)_method_pop "direct link")
  
  See primary documentation
  [in context](/type/Buf#method_pop)
  for **method pop**.
  
  ```raku
  method pop()
  ```
  
  Returns and removes the last element of the buffer.
  
  ```raku
  my $bú = Buf.new( 1, 1, 2, 3, 5 );
  say $bú.pop(); # OUTPUT: «5␤»
  say $bú.raku;  # OUTPUT: «Buf.new(1,1,2,3)␤»
  ```
  
  # [In Array](#___top "go to top of document")[§](#(Array)_method_pop "direct link")
  
  See primary documentation
  [in context](/type/Array#method_pop)
  for **method pop**.
  
  ```raku
  method pop(Array:D:) is nodal
  ```
  
  Removes and returns the last item from the array. Fails if the array is empty.
  
  Like many `Array` methods, method `pop` may be called via the corresponding [subroutine](/type/independent-routines#sub_pop). For example:
  
  ```raku
  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␤»
  ```
  
  # [In Independent routines](#___top "go to top of document")[§](#(Independent_routines)_sub_pop "direct link")
  
  See primary documentation
  [in context](/type/independent-routines#sub_pop)
  for **sub pop**.
  
  ```raku
  multi pop(@a) is raw
  ```
  
  Calls method `pop` on the [`Positional`](/type/Positional) argument. That method is supposed to remove and return the last element, or return a [`Failure`](/type/Failure) wrapping an [`X::Cannot::Empty`](/type/X/Cannot/Empty) if the collection is empty.
  
  See the documentation of the [`Array` method](/routine/pop#(Array)_method_pop) for an example.
  