Last
[expr]Last
[expr, def] Last[expr]
is equivalent to expr[[-1]]
.
Last[{a, b, c}]
The first argument need not be a list:
Last[a + b + c]
However, the first argument must be Nonatomic when there is a single argument:
Last[10]
Or if it is not, but a second default argument is provided, that is evaluated and returned:
Last[10, 1+2]
Last[{}]
{} has zero length and no last element.
As before, the first argument is empty, but since default argument is given, evaluate and return the second argument:
Last[{}, 1+2]