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 >

First

First[expr]
gives the first element in expr.
  • First[expr] is equivalent to expr[[1]].
Extract the first element of a list:
Extract the first row of a matrix:
The head need not be List:
Extract the first element of a list:
In[1]:=
Click for copyable input
Out[1]=
 
Extract the first 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]=
First[expr] is equivalent to expr[[1]]:
The expression is evaluated before First is applied:
First 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