tmp/tmp3d5wwi3i/{from.md → to.md}
RENAMED
|
@@ -1,34 +1,29 @@
|
|
| 1 |
### The `while` statement <a id="stmt.while">[[stmt.while]]</a>
|
| 2 |
|
| 3 |
In the `while` statement the substatement is executed repeatedly until
|
| 4 |
-
the value of the condition
|
| 5 |
takes place before each execution of the substatement.
|
| 6 |
|
| 7 |
When the condition of a `while` statement is a declaration, the scope of
|
| 8 |
-
the variable that is declared extends from its point of declaration
|
| 9 |
-
[[basic.scope.pdecl]]
|
| 10 |
-
statement
|
| 11 |
|
| 12 |
-
```
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
is equivalent to
|
| 17 |
-
|
| 18 |
-
``` cpp
|
| 19 |
-
label:
|
| 20 |
-
{ // start of condition scope
|
| 21 |
-
T t = x;
|
| 22 |
-
if (t) {
|
| 23 |
statement
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
}
|
| 27 |
```
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
iteration of the loop.
|
| 31 |
|
| 32 |
[*Example 1*:
|
| 33 |
|
| 34 |
``` cpp
|
|
@@ -49,5 +44,7 @@ In the while-loop, the constructor and destructor are each called twice,
|
|
| 49 |
once for the condition that succeeds and once for the condition that
|
| 50 |
fails.
|
| 51 |
|
| 52 |
— *end example*]
|
| 53 |
|
|
|
|
|
|
|
|
|
| 1 |
### The `while` statement <a id="stmt.while">[[stmt.while]]</a>
|
| 2 |
|
| 3 |
In the `while` statement the substatement is executed repeatedly until
|
| 4 |
+
the value of the condition [[stmt.select]] becomes `false`. The test
|
| 5 |
takes place before each execution of the substatement.
|
| 6 |
|
| 7 |
When the condition of a `while` statement is a declaration, the scope of
|
| 8 |
+
the variable that is declared extends from its point of declaration
|
| 9 |
+
[[basic.scope.pdecl]] to the end of the `while` *statement*. A `while`
|
| 10 |
+
statement is equivalent to
|
| 11 |
|
| 12 |
+
``` bnf
|
| 13 |
+
label ':'
|
| 14 |
+
'{'
|
| 15 |
+
if '(' condition ')' '{'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
statement
|
| 17 |
+
goto label ';'
|
| 18 |
+
'}'
|
| 19 |
+
'}'
|
| 20 |
```
|
| 21 |
|
| 22 |
+
[*Note 1*:
|
| 23 |
+
|
| 24 |
+
The variable created in the condition is destroyed and created with each
|
| 25 |
iteration of the loop.
|
| 26 |
|
| 27 |
[*Example 1*:
|
| 28 |
|
| 29 |
``` cpp
|
|
|
|
| 44 |
once for the condition that succeeds and once for the condition that
|
| 45 |
fails.
|
| 46 |
|
| 47 |
— *end example*]
|
| 48 |
|
| 49 |
+
— *end note*]
|
| 50 |
+
|