pop - Removes the last element from array and returns it.
pop(array)
pop(array, elem1, ...)
This function removes the last element of an array. and returns it.
So if a = [1,2,3,4,5]; pop(a) return 5 and a has value 1,2,3,4.
In the second form, pop remove the element based on the position starting at zero.
If the value of elem is less than zero, it will remove the element based on the position from the end starting at 1.
The second form is available from version 5.89
a = [1,2,3,4,5]; a.top(); a.last(); a.shift(); a; a.pop(); a; will return es=151[2,3,4,5]5[2,3,4].
a = [1,2,3,4,5];
a.pop(-2,-4);
a;
return res=[4,2][1,3,5].
a = [1,2,3,4,5];
a.pop(-2,-100);
a;
return array is size 5 and you try to remove element -100
a = [1,2,3,4,5];
a.pop(2,3);
a;
return res=[3,4][1,2,5].
a = [1,2,3,4,5];
a.pop(0,1, 2,3);
a;
return res=[1,2,3,4][5].
a = [1,2,3,4,5];
a.pop(0,1, 2,3,4);
a;
return res=[1,2,3,4,5][].
a = [1,2,3,4,5];
a.pop(0,1, 2,3,4,5);
a;
return array is size 5 and you try to remove element 5
a = [1,2,3,4,5];
a.pop(2,3, 10);
a;
return array is size 5 and you try to remove element 10
a = [1,2,3,4,5];
a.pop(2,3, -10);
a;
return array is size 5 and you try to remove element -10
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com