last

Syntax

last(X) / last X

Arguments

X is a scalar/vector/matrix/table.

Details

Return the last element of a vector, or the last row of a matrix or table.

If the last element is null, the function returns NULL. To get the last non-null element, use lastNot.

Examples

last(`hello `world);
// output: world

last(1..10);
// output: 10

m = matrix(1 2 3, 4 5 6);
m;
#0 #1
1 4
2 5
3 6
last(m);
// output: [3,6]

Related function: first