diff options
| author | John Gallagher <jgallagher@bignerdranch.com> | 2014-10-03 01:09:01 -0400 |
|---|---|---|
| committer | John Gallagher <jgallagher@bignerdranch.com> | 2014-10-10 20:30:32 -0400 |
| commit | 0d6dafa51fb6d5a1a2bee788801f384b9355b08a (patch) | |
| tree | 7d9fda2472e7892c485a352fa9a35178cbba9f87 | |
| parent | b5db97b354e5b1e1b5d99f513a40493f223fddae (diff) | |
Add `while let` to the reference
Closes #17687
| -rw-r--r-- | src/doc/reference.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index 261e5edcf66..4ad64576e15 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -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} |
