Skip to content

Commit

Permalink
Add while let to the reference
Browse files Browse the repository at this point in the history
Closes #17687
  • Loading branch information
hydhknn committed Oct 11, 2014
1 parent b5db97b commit 0d6dafa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 0d6dafa

Please sign in to comment.