Last
✖
Last
Examples
open allclose allBasic Examples (5)Summary of the most common use cases
Extract the last element of a list:
In[1]:=1

✖
https://wolfram.com/xid/0mrgoi-uuw
Out[1]=1

Extract the last row of a matrix:
In[1]:=1

✖
https://wolfram.com/xid/0mrgoi-hnh
Out[1]=1

Extract the last element of an association:
In[1]:=1

✖
https://wolfram.com/xid/0mrgoi-cchagp
Out[1]=1

The head need not be List:
In[1]:=1

✖
https://wolfram.com/xid/0mrgoi-vh
Out[1]=1

Return x if there are zero elements:
In[1]:=1

✖
https://wolfram.com/xid/0mrgoi-b608as
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0mrgoi-81keoj
Out[2]=2

Generalizations & Extensions (1)Generalized and extended use cases
Properties & Relations (1)Properties of the function, and connections to other functions
Last[expr] is equivalent to expr[[-1]]:
In[1]:=1

✖
https://wolfram.com/xid/0mrgoi-qke
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0mrgoi-ghg
Out[2]=2

Possible Issues (2)Common pitfalls and unexpected behavior
Wolfram Research (1988), Last, Wolfram Language function, https://reference.wolfram.com/language/ref/Last.html (updated 2015).
✖
Wolfram Research (1988), Last, Wolfram Language function, https://reference.wolfram.com/language/ref/Last.html (updated 2015).
Text
Wolfram Research (1988), Last, Wolfram Language function, https://reference.wolfram.com/language/ref/Last.html (updated 2015).
✖
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.
✖
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
✖
Wolfram Language. (1988). Last. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Last.html
BibTeX
✖
@misc{reference.wolfram_2025_last, author="Wolfram Research", title="{Last}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/Last.html}", note=[Accessed: 24-March-2025
]}
BibLaTeX
✖
@online{reference.wolfram_2025_last, organization={Wolfram Research}, title={Last}, year={2015}, url={https://reference.wolfram.com/language/ref/Last.html}, note=[Accessed: 24-March-2025
]}