jargon

Design patterns·Functional ideas that went mainstream

one expression takes the value apart, names its pieces and picks a branch, all in the same line.

Pattern matching

Also calleddestructuring match, match expression, structural matching

Branching on the shape of a value while simultaneously binding its parts. It is the natural way to consume an algebraic data type, and it is now in most mainstream languages in some form. Its practical advantage over a chain of type checks is that the compiler can see the whole set of cases, which is what makes exhaustiveness checking possible.

Commonly confused with