last()

Retrieve the last item in a list.

Synopsis

last(list-expression)

Description

Returns the value of the last item from the list parameter. Throws an error.

Parameters

list-expression

An expression that evaluates to a list, including the name of a list variable.

Examples

A_list = list(1,2,3)
my_last_item = last(A_list)         # my_last_item is now 3

Errors

It is an error if the list is empty.

See Also

length(), list(), pop(), push()