This is the ThingsDB documentation for version v0, click here for the latest version!


Returns the last item in the list. A lookup_err() is raised when this function is used on an empty list unless a default value is given, in which case the given value will be returned.

ThingsDB uses lazy-evaluation of function arguments. For this reason the default value might be a function call or code block which will only be evaluated when the list is empty.

This function does not generate an event.




Argument Type Description
alt any (optional) Alternative value which is returned when the list is empty.

Return value

Last item in the list.


This code shows an example using last():

["January", "February", "March", "April"].last();

Return value in JSON format