Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/expressions/if-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ assert_eq!(y, "Bigger");

> **<sup>Syntax</sup>**\
> _IfLetExpression_ :\
> &nbsp;&nbsp; `if` `let` [_Pattern_] `=` [_Expression_]<sub>_except struct or lazy boolean operator expression_</sub>
> &nbsp;&nbsp; `if` `let` [_Pattern_] `=` [_Scrutinee_]<sub>_except lazy boolean operator expression_</sub>
> [_BlockExpression_]\
> &nbsp;&nbsp; (`else` (
> [_BlockExpression_]
Expand Down Expand Up @@ -148,6 +148,7 @@ if let PAT = ( EXPR || EXPR ) { .. }
[_Expression_]: ../expressions.md
[_LazyBooleanOperatorExpression_]: operator-expr.md#lazy-boolean-operators
[_Pattern_]: ../patterns.md
[_Scrutinee_]: match-expr.md
[_eRFCIfLetChain_]: https://github.com/rust-lang/rfcs/blob/master/text/2497-if-let-chains.md#rollout-plan-and-transitioning-to-rust-2018
[`match` expression]: match-expr.md
[boolean type]: ../types/boolean.md
Expand Down
4 changes: 3 additions & 1 deletion src/expressions/loop-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ while i < 10 {

> **<sup>Syntax</sup>**\
> [_PredicatePatternLoopExpression_] :\
> &nbsp;&nbsp; `while` `let` [_Pattern_] `=` [_Expression_]<sub>_except struct or lazy boolean operator expression_</sub>
> &nbsp;&nbsp; `while` `let` [_Pattern_] `=` [_Scrutinee_]<sub>_except lazy boolean operator expression_</sub>
> [_BlockExpression_]


A `while let` loop is semantically similar to a `while` loop but in place of a condition expression it expects the keyword `let` followed by a pattern, an `=`, a [scrutinee] expression and a block expression.
If the value of the scrutinee matches the pattern, the loop body block executes then control returns to the pattern matching statement.
Otherwise, the while expression completes.
Expand Down Expand Up @@ -264,6 +265,7 @@ In the case a `loop` has an associated `break`, it is not considered diverging,
[_BlockExpression_]: block-expr.md
[_Expression_]: ../expressions.md
[_Pattern_]: ../patterns.md
[_Scrutinee_]: match-expr.md
[`match` expression]: match-expr.md
[boolean]: ../types/boolean.md
[scrutinee]: ../glossary.md#scrutinee
Expand Down
5 changes: 4 additions & 1 deletion src/expressions/match-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

> **<sup>Syntax</sup>**\
> _MatchExpression_ :\
> &nbsp;&nbsp; `match` [_Expression_]<sub>_except struct expression_</sub> `{`\
> &nbsp;&nbsp; `match` _Scrutinee_ `{`\
> &nbsp;&nbsp; &nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>\
> &nbsp;&nbsp; &nbsp;&nbsp; _MatchArms_<sup>?</sup>\
> &nbsp;&nbsp; `}`
>
>_Scrutinee_ :\
> &nbsp;&nbsp; [_Expression_]<sub>_except struct expression_</sub>
>
> _MatchArms_ :\
> &nbsp;&nbsp; ( _MatchArm_ `=>`
> ( [_ExpressionWithoutBlock_][_Expression_] `,`
Expand Down