Click or drag to resize

array.contains Function

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

The array.contains function may be used to determine if a given expression is present in an array.

Syntax

Alchemy
array.contains(ident, expr);

Nomenclature

identRequired. The array
exprRequired. An expression

Example

The following example creates a new array initialized with two elements: '1' and '2'.

We then append a third element, '3', to the end of the array using the array.add function.

Alchemy
$arr = array.new(1, 2);
PRINT $arr; /* [1,2] */
PRINT array.contains($arr, 2); /* false */

array.add($arr, 3);
PRINT $arr; /* [1,2,3] */
PRINT array.contains($arr, 2); /* true */

Returns

True if epxr is equal to one or more elements in the ident array. Otherwise returns false.

See Also

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

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

  • length - get the number of elements in an array