Click or drag to resize

array.range Function

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

The array.range function selects a number of consecutive elements from a specified array. The selected elements are returned in an array. The order of the elements is not altered.

Tip Tip

All Alchemy arrays use zero-based indexing.

Syntax

Alchemy
array.range(ident, idx, len);

Nomenclature

identAn array identifier
idx The index of the ident array to start selection from
lenThe number of elements to select

Example

The following example creates a new array. We then use the array.range function to select three elements from the array, starting at the third (index 2) element.

Alchemy
$arr = array.new("T","E","L","O","G","I","S");
PRINT array.range($arr, 2, 3);

Output:

[L,O,G]

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.get_at - retrieve the data at a specified index of an array

  • length - get the number of elements in an array