tmp/tmpgju6e89m/{from.md → to.md}
RENAMED
|
@@ -1,25 +1,35 @@
|
|
| 1 |
### The `for` statement <a id="stmt.for">[[stmt.for]]</a>
|
| 2 |
|
| 3 |
The `for` statement
|
| 4 |
|
| 5 |
``` bnf
|
| 6 |
-
|
| 7 |
```
|
| 8 |
|
| 9 |
is equivalent to
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
except that names declared in the *init-statement* are in the same
|
| 12 |
declarative region as those declared in the *condition*, and except that
|
| 13 |
a `continue` in *statement* (not enclosed in another iteration
|
| 14 |
statement) will execute *expression* before re-evaluating *condition*.
|
| 15 |
|
| 16 |
[*Note 1*: Thus the first statement specifies initialization for the
|
| 17 |
-
loop; the condition
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
Either or both of the *condition* and the *expression* can be omitted. A
|
| 23 |
missing *condition* makes the implied `while` clause equivalent to
|
| 24 |
`while(true)`.
|
| 25 |
|
|
|
|
| 1 |
### The `for` statement <a id="stmt.for">[[stmt.for]]</a>
|
| 2 |
|
| 3 |
The `for` statement
|
| 4 |
|
| 5 |
``` bnf
|
| 6 |
+
for '(' init-statement conditionₒₚₜ ';' expressionₒₚₜ ')' statement
|
| 7 |
```
|
| 8 |
|
| 9 |
is equivalent to
|
| 10 |
|
| 11 |
+
``` bnf
|
| 12 |
+
'{'
|
| 13 |
+
init-statement
|
| 14 |
+
while '(' condition ')' '{'
|
| 15 |
+
statement
|
| 16 |
+
expression ';'
|
| 17 |
+
'}'
|
| 18 |
+
'}'
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
except that names declared in the *init-statement* are in the same
|
| 22 |
declarative region as those declared in the *condition*, and except that
|
| 23 |
a `continue` in *statement* (not enclosed in another iteration
|
| 24 |
statement) will execute *expression* before re-evaluating *condition*.
|
| 25 |
|
| 26 |
[*Note 1*: Thus the first statement specifies initialization for the
|
| 27 |
+
loop; the condition [[stmt.select]] specifies a test, sequenced before
|
| 28 |
+
each iteration, such that the loop is exited when the condition becomes
|
| 29 |
+
`false`; the expression often specifies incrementing that is sequenced
|
| 30 |
+
after each iteration. — *end note*]
|
| 31 |
|
| 32 |
Either or both of the *condition* and the *expression* can be omitted. A
|
| 33 |
missing *condition* makes the implied `while` clause equivalent to
|
| 34 |
`while(true)`.
|
| 35 |
|