Last Procedure

If the List contains at least one value, then the last element returned. If not, an error is thrown.
Declaration
function Last(list as List of T) as T

Parameters

Return value

The last element of list.

Example

This example program shows how to use First and Len together.
Code
sub PrintLastNumberIfPresent(x as List of Number)
if Len(x) > 0 then
print Last(x)
else
print "Empty list!"
end if
end sub
sub Main()
dim x = [1, 2, 3]
PrintLastNumberIfPresent x
dim y as List of Number
PrintLastNumberIfPresent y
end sub
Output
3
Empty list!