Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Expressions > Parts of Expressions >

Last

Last[expr]
gives the last element in expr.
  • Last[expr] is equivalent to expr[[-1]].
Extract the last element of a list:
Extract the last row of a matrix:
The head need not be List:
Extract the last element of a list:
In[1]:=
Click for copyable input
Out[1]=
 
Extract the last row of a matrix:
In[1]:=
Click for copyable input
Out[1]=
 
The head need not be List:
In[1]:=
Click for copyable input
Out[1]=
Last[expr] is equivalent to expr[[-1]].
The expression is evaluated before Last is applied:
Last always operates on the FullForm of expressions:
New in 1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team