Method: Array#pop

Defined in:
array.c

#popObject? #pop(n) ⇒ Array

Removes the last element from self and returns it, or nil if the array is empty.

If a number n is given, returns an array of the last n elements (or less) just like array.slice!(-n, n) does.

a = [ "a", "b", "c", "d" ]
a.pop     #=> "d"
a.pop(2)  #=> ["b", "c"]
a         #=> ["a"]

Overloads:



531
532
533
# File 'array.c', line 531

static VALUE
rb_ary_pop_m(argc, argv, ary)
int argc;