Add while let to the reference

Closes #17687
This commit is contained in:
John Gallagher 2014-10-03 01:09:01 -04:00
parent b5db97b354
commit 0d6dafa51f

View File

@ -3511,6 +3511,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}