last
arrayReturns the last element of an array
Syntax
last(array) Parameters
array (array) The array to get the last element from
Returns
any The last element of the array
Examples
Input:
[1, 2, 3] | last Output:
3 Input:
["apple", "banana", "cherry"] | last Output:
"cherry" The last() function retrieves the last element from an array. It provides a convenient way to access the final element without using array indexing.
Usage
This function is useful for getting the most recent entry, accessing the final element of a sequence, or working with the end of a dataset.