mirror of https://github.com/rust-lang/reference
parent
fa558588a7
commit
29d41459ef
12
reference.md
12
reference.md
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue