Select

Select[list,crit]
picks out all elements of list for which is True.

Select[list,crit,n]
picks out the first n elements for which is True.

Select[crit]
represents an operator form of Select that can be applied to an expression.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (5)Basic Examples  (5)

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]=

Use the operator form of Select:

In[1]:=
Click for copyable input
Out[1]=

Select operates on values in an Association:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 1988
(1.0)
| Updated in 2014
(10.0)