gives the first ei for which crit[ei] is True, or Missing["NotFound"] if none is found.


gives default if there is no ei such that crit[ei] is True.


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



open allclose all

Basic Examples  (4)

Select the first element that is even:

Use a pure function to test elements:

Give the default x when no even numbers are found:

SelectFirst operates on values in an Association:

Scope  (3)

Use the operator form of SelectFirst:

Find the first pair containing x:

Use a custom default value:

Generalizations & Extensions  (2)

SelectFirst works with any head, not just List:

SelectFirst works with SparseArray objects:

Properties & Relations  (4)

The default value is only evaluated if needed:

SelectFirst returns only the first match:

Select returns all matches:

SelectFirst can be implemented with a combination of Select and Replace:

SelectFirst is similar to FirstCase except that it uses a function instead of a pattern:

Select the first list that has a sum of elements less than 10:

Use FirstCase to get the same result:

Wolfram Research (2014), SelectFirst, Wolfram Language function,


Wolfram Research (2014), SelectFirst, Wolfram Language function,


Wolfram Language. 2014. "SelectFirst." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2014). SelectFirst. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_selectfirst, author="Wolfram Research", title="{SelectFirst}", year="2014", howpublished="\url{}", note=[Accessed: 01-December-2023 ]}


@online{reference.wolfram_2023_selectfirst, organization={Wolfram Research}, title={SelectFirst}, year={2014}, url={}, note=[Accessed: 01-December-2023 ]}