diff --git a/src/expressions/match-expr.md b/src/expressions/match-expr.md index 23e2d9f081fe3..7b5afc1176334 100644 --- a/src/expressions/match-expr.md +++ b/src/expressions/match-expr.md @@ -1,5 +1,15 @@ # `match` expressions +> **Syntax** +> _MatchExpression_ : +>    `match` [_Expression_]_except struct expression_ _MatchBlock_ +> +> _MatchBlock_ : +>       `{` `}` +>    | `{` (`|`? _Pattern_ (`|` _Pattern_)\* (`if` [_Expression_])? `=>` ([_BlockExpression_] `,`? | [_Expression_] `,`))\* +>            (`|`? _Pattern_ (`|` _Pattern_)\* (`if` [_Expression_])? `=>` ([_BlockExpression_] `,`? | [_Expression_] `,`?)) +>       `}` + A `match` expression branches on a *pattern*. The exact form of matching that occurs depends on the pattern. Patterns consist of some combination of literals, destructured arrays or enum constructors, structs and tuples, @@ -127,5 +137,7 @@ let message = match maybe_digit { }; ``` +[_Expression_]: expressions.html +[_BlockExpression_]: expressions/block-expr.html#block-expressions [place expression]: expressions.html#place-expressions-and-value-expressions -[value expression]: expressions.html#place-expressions-and-value-expressions \ No newline at end of file +[value expression]: expressions.html#place-expressions-and-value-expressions