Click or drag to resize

array.pop Function

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
array.pop Function

The array.pop function removes and returns the element at the head of the specified array.

Syntax

Alchemy
array.pop(ident);

Nomenclature

identAn array identifier

Returns

The first element from the array, or null if the array was empty.

Example

The following code snippet demonstrates the use of the function array.pop:

  • We create a new array initialized with a three elements: '1', '2' and '3'
  • We pop an element from the array and print the popped element
  • The array now has two elements: '2' and '3'
Alchemy
$arr = array.new(1, 2, 3);
PRINT $arr; /* [1,2,3] */
PRINT array.pop($arr); /* 1 */
PRINT $arr; /* [2,3] */

See Also

  • array.add - add an element to the tail of an array

  • array.new - create a new array

  • array.pop - remove and return the element at the head of the array

  • array.set_at - modify the data at a specified index of an array

  • length - get the number of elements in an array