diff options
| author | Piotr Jawniak <sawyer47@gmail.com> | 2014-05-12 18:17:13 +0200 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-12 19:52:29 -0700 |
| commit | 06ea9893d58624e348cc0b4bcc3da0bda6c28327 (patch) | |
| tree | f925ef669af08b010a8b4480ebac9399db58abd7 /src | |
| parent | 31de69d0dd816fc0447df2e19d8935f68484ed64 (diff) | |
| download | rust-06ea9893d58624e348cc0b4bcc3da0bda6c28327.tar.gz rust-06ea9893d58624e348cc0b4bcc3da0bda6c28327.zip | |
doc: updates rust manual (loop to continue)
Keyword for continue expressions was changed from loop to continue, but the manual was not updated.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/rust.md | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/doc/rust.md b/src/doc/rust.md index 6919bcfeb7a..7f0c27b4632 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -208,7 +208,7 @@ The keywords are the following strings: ~~~~ {.notrust .keyword} as box break -crate +continue crate else enum extern false fn for if impl in @@ -2924,9 +2924,7 @@ while i < 10 { ### Infinite loops -The keyword `loop` in Rust appears both in _loop expressions_ and in _continue expressions_. -A loop expression denotes an infinite loop; -see [Continue expressions](#continue-expressions) for continue expressions. +A `loop` expression denotes an infinite loop. ~~~~ {.notrust .ebnf .gram} loop_expr : [ lifetime ':' ] "loop" '{' block '}'; @@ -2934,8 +2932,8 @@ loop_expr : [ lifetime ':' ] "loop" '{' block '}'; A `loop` expression may optionally have a _label_. If a label is present, -then labeled `break` and `loop` expressions nested within this loop may exit out of this loop or return control to its head. -See [Break expressions](#break-expressions). +then labeled `break` and `continue` expressions nested within this loop may exit out of this loop or return control to its head. +See [Break expressions](#break-expressions) and [Continue expressions](#continue-expressions). ### Break expressions @@ -2953,21 +2951,21 @@ but must enclose it. ### Continue expressions ~~~~ {.notrust .ebnf .gram} -continue_expr : "loop" [ lifetime ]; +continue_expr : "continue" [ lifetime ]; ~~~~ -A continue expression, written `loop`, also has an optional `label`. +A `continue` expression has an optional `label`. If the label is absent, -then executing a `loop` expression immediately terminates the current iteration of the innermost loop enclosing it, +then executing a `continue` expression immediately terminates the current iteration of the innermost loop enclosing it, returning control to the loop *head*. In the case of a `while` loop, the head is the conditional expression controlling the loop. In the case of a `for` loop, the head is the call-expression controlling the loop. -If the label is present, then `loop foo` returns control to the head of the loop with label `foo`, +If the label is present, then `continue foo` returns control to the head of the loop with label `foo`, which need not be the innermost label enclosing the `break` expression, but must enclose it. -A `loop` expression is only permitted in the body of a loop. +A `continue` expression is only permitted in the body of a loop. ### For expressions |
