array:head

Returns the first member of an array, that is $array(1).

Signature

array:head($array as array(*)) as item()*

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

The function returns first member of $array, that is the value of $array(1).

Error Conditions

A dynamic error occurs [ERRFOAY0001] if $array is empty.

Examples

The expression array:head([5, 6, 7, 8]) returns 5.

The expression array:head([["a", "b"], ["c", "d"]]) returns ["a", "b"].

The expression array:head([("a", "b"), ("c", "d")]) returns "a", "b".