Skip to main content

List.First

Returns the first value of the list or the specified default if empty.

Syntax

List.First(
list as list,
optional defaultValue as any
) as any

Remarks

Returns the first item in the list list, or the optional default value, defaultValue, if the list is empty. If the list is empty and a default value is not specified, the function returns null.

Examples

Example #1

Find the first value in the list {1, 2, 3}.

List.First({1, 2, 3})

Result:

1

Example #2

Find the first value in the list {}. If the list is empty, return -1.

List.First({}, -1)

Result:

-1

Category

List.Selection