discard

The underscore _, used in a pattern to match anything, such as the final catch-all arm of a switch expression.

In more detail

A discard arm guarantees every input gets an answer, but it also silences the exhaustiveness warning. Leave it off when the set of values is closed, such as an enum, so that new members are flagged.

Example

_ => "many"

Related terms

Taught in

References