Pattern Matching
Pattern match statements are an extension of the case
expression. They introduce a new keyword to case
statements: in
.
in
expression
The in
is used in place of when
to use pattern matching behaviors. These two syntaxes cannot be mixed.
An in
expression is different from when
in that it allows one to match against data structures: