Skip to content

Commit e8f420d

Browse files
authored
Merge pull request #772 from steffahn/master
Add information about || and && to grammar describing `while let`.
2 parents 05189cf + 532060a commit e8f420d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/expressions/loop-expr.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ have type compatible with the value of the `break` expression(s).
4545

4646
> **<sup>Syntax</sup>**\
4747
> _PredicateLoopExpression_ :\
48-
> &nbsp;&nbsp; `while` [_Expression_]<sub>except struct expression</sub> [_BlockExpression_]
48+
> &nbsp;&nbsp; `while` [_Expression_]<sub>_except struct expression_</sub> [_BlockExpression_]
4949
5050
A `while` loop begins by evaluating the boolean loop conditional expression. If
5151
the loop conditional expression evaluates to `true`, the loop body block
@@ -67,7 +67,7 @@ while i < 10 {
6767

6868
> **<sup>Syntax</sup>**\
6969
> [_PredicatePatternLoopExpression_] :\
70-
> &nbsp;&nbsp; `while` `let` [_MatchArmPatterns_] `=` [_Expression_]<sub>except struct expression</sub>
70+
> &nbsp;&nbsp; `while` `let` [_MatchArmPatterns_] `=` [_Expression_]<sub>_except struct or lazy boolean operator expression_</sub>
7171
> [_BlockExpression_]
7272
7373
A `while let` loop is semantically similar to a `while` loop but in place of a
@@ -123,11 +123,13 @@ while let Some(v @ 1) | Some(v @ 2) = vals.pop() {
123123
}
124124
```
125125

126+
As is the case in [`if let` expressions], the scrutinee cannot be a [lazy boolean operator expression][_LazyBooleanOperatorExpression_].
127+
126128
## Iterator loops
127129

128130
> **<sup>Syntax</sup>**\
129131
> _IteratorLoopExpression_ :\
130-
> &nbsp;&nbsp; `for` [_Pattern_] `in` [_Expression_]<sub>except struct expression</sub>
132+
> &nbsp;&nbsp; `for` [_Pattern_] `in` [_Expression_]<sub>_except struct expression_</sub>
131133
> [_BlockExpression_]
132134
133135
A `for` expression is a syntactic construct for looping over elements provided
@@ -294,3 +296,5 @@ expression `()`.
294296
[`match` expression]: match-expr.md
295297
[scrutinee]: ../glossary.md#scrutinee
296298
[temporary values]: ../expressions.md#temporary-lifetimes
299+
[_LazyBooleanOperatorExpression_]: operator-expr.md#lazy-boolean-operators
300+
[`if let` expressions]: if-expr.md#if-let-expressions

0 commit comments

Comments
 (0)