Click or drag to resize

array.get_at Function

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

The array.get_at function retrieves the data stored at a specified index in the array.

Alchemy arrays use zero-based indexing.

Syntax

Alchemy
array.get_at(ident, idx);

Nomenclature

identAn array identifier
idx The element of ident to get, specified as an index number

Example

The following example creates a new array initialized with a five elements: 1, 2, 3, 4 and 5. We loop five times, on each iteration we print an element retrieved by the array.get_at function, starting with the tail of the array ('5') and moving towards the head ('1').

Alchemy
$arr = array.new(1,2,3,4,5);
$counter = 5;
WHILE $counter > 0
BEGIN
  $counter = $counter - 1;
  PRINT array.get_at($arr, $counter);
END

Output:

5

4

3

2

1

See Also

  • array.first - get the first element of an array

  • array.flatten - expand elements of an array that are, themselves, arrays

  • array.join - convert an array to a string by joining all the elements

  • array.last - get the last element of an array

  • array.new - create a new array

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

  • array.range - return a sub-array from a specified array

  • array.get_at - retrieve the data at a specified index of an array

  • length - get the number of elements in an array