Add `while let` to the reference

Closes #17687
This commit is contained in:
John Gallagher 2014-10-03 01:09:01 -04:00 committed by Manish Goregaokar
parent fa558588a7
commit 29d41459ef
1 changed files with 12 additions and 0 deletions

View File

@ -3496,6 +3496,18 @@ of a condition expression it expects a refutable let statement. If the value of
expression on the right hand side of the let statement matches the pattern, the corresponding
block will execute, otherwise flow proceeds to the first `else` block that follows.
### While let loops
```{.ebnf .gram}
while_let_expr : "while" "let" pat '=' expr '{' block '}' ;
```
A `while let` loop is semantically identical to a `while` loop but in place of a
condition expression it expects a refutable let statement. If the value of the
expression on the right hand side of the let statement matches the pattern, the
loop body block executes and control returns to the pattern matching statement.
Otherwise, the while expression completes.
### Return expressions
```{.ebnf .gram}