Select

Select[list,crit]

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

Select[list,crit,n]

picks out the first n elements for which crit[ei] is True.

Select[crit]

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

Details

Examples

open allclose all

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

Scope  (5)

Generalizations & Extensions  (2)

Applications  (7)

Properties & Relations  (1)

See Also

SelectFirst  Cases  Take  Drop  Reap  Pick  MatchQ  StringMatchQ

Tutorials

Introduced in 1988
(1.0)
| Updated in 2014
(10.0)