This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Select

Select
picks out all elements of list for which is True.
Select
picks out the first n elements for which is True.
  • The object list can have any head, not necessarily List.
Select elements that are even:
Use a pure function to test each element:
Return only the first expression selected:
Select elements that are even:
In[1]:=
Click for copyable input
Out[1]=
 
Use a pure function to test each element:
In[1]:=
Click for copyable input
Out[1]=
 
Return only the first expression selected:
In[1]:=
Click for copyable input
Out[1]=
Select picks out elements for which applying the criterion explicitly yields True:
Applying the criterion to the symbolic object does not explicitly yield True:
Select works with any head, not just List:
Select works with SparseArray objects:
The result may be a list if it is not sparse:
Select numbers up to 100 that equal 1 modulo both 3 and 5:
Select 4-tuples that read the same in reverse:
Find the first four 3×3 matrices of 0s and 1s that have determinant 1:
Select eigenvalues that lie within the unit circle:
Find built-in Mathematica objects whose names are less than 3 characters long:
Select numeric quantities from a product:
Find an approximation to by finding the proportion of points that lie within a disk:
Select is similar to Cases except that it uses a function instead of a pattern:
Select the lists that have sum of elements less than 10:
Use Cases to get the same result:
New in 1 | Last modified in 5