Skip to main content

List.Last

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

Syntax​

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

Remarks​

Returns the last item in the specified list, or the optional default value if the list is empty.

  • list: The list to examine.
  • defaultValue: (Optional) The default value to return if the list is empty. If the list is empty and a default value isn't specified, the function returns null.

Examples​

Example #1​

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

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

Result:

3

Example #2​

Find the last value in the list {} or -1 if it empty.

List.Last({}, -1)

Result:

-1

Category​

List.Selection