FirstCase

WMA link


FirstCase[{$e_1$, $e_2$, ...}, pattern]

gives the first ei to match pattern, or $Missing[“NotFound”]$ if none matching pattern is found.

FirstCase[{$e_1$,$e_2$, ...}, pattern -> rhs]

gives the value of rhs corresponding to the first ei to match pattern.

FirstCase[expr, pattern, default]

gives default if no element matching pattern is found.

FirstCase[expr, pattern, default, levelspec]

finds only objects that appear on levels specified by levelspec.

FirstCase[pattern]

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

First
FirstPosition