Last
Last[expr]
gives the last element in expr.
Last[expr,def]
gives the last element if there are any elements, or def otherwise.
Examples
open allclose allBasic Examples (5)
Extract the last element of a list:
Extract the last row of a matrix:
Extract the last element of an association:
The head need not be List:
Generalizations & Extensions (1)
Last works on SparseArray objects:
Properties & Relations (1)
Last[expr] is equivalent to expr[[-1]]:
Text
Wolfram Research (1988), Last, Wolfram Language function, https://reference.wolfram.com/language/ref/Last.html (updated 2015).
CMS
Wolfram Language. 1988. "Last." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/Last.html.
APA
Wolfram Language. (1988). Last. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Last.html