C# LANGUAGE SPECIFICATION
do-statement: do embedded-statement while ( boolean-expression ) ;
A do statement is executed as follows:
Control is transferred to the embedded statement.
When and if control reaches the end point of the embedded statement (possibly from execution of a continue statement), the boolean-expression (§7.16) is evaluated. If the boolean expression yields true, control is transferred to the beginning of the do statement. Otherwise, control is transferred to the end point of the do statement.
Within the embedded statement of a do statement, a break statement (§8.9.1) may be used to transfer control to the end point of the do statement (thus ending iteration of the embedded statement), and a continue statement (§8.9.2) may be used to transfer control to the end point of the embedded statement.
The embedded statement of a do statement is reachable if the do statement is reachable.
The end point of a do statement is reachable if at least one of the following is true:
The do statement contains a reachable break statement that exits the do statement.
The end point of the embedded statement is reachable and the boolean expression does not have the constant value true.
8.8.3 The for statement
The for statement evaluates a sequence of initialization expressions and then, while a condition is true, repeatedly executes an embedded statement and evaluates a sequence of iteration expressions.
for-statement: for ( for-initializeropt ; for-conditionopt ; for-iteratoropt ) embedded-statement
for-initializer: local-variable-declaration statement-expression-list
statement-expression-list: statement-expression statement-expression-list , statement-expression
The for-initializer, if present, consists of either a local-variable-declaration (§8.5.1) or a list of statement-expressions (§8.6) separated by commas. The scope of a local variable declared by a for-initializer starts at the local-variable-declarator for the variable and extends to the end of the embedded statement. The scope includes the for-condition and the for-iterator.
The for-condition, if present, must be a boolean-expression (§7.16).
The for-iterator, if present, consists of a list of statement-expressions (§8.6) separated by commas.
A for statement is executed as follows:
If a for-initializer is present, the variable initializers or statement expressions are executed in the order they are written. This step is only performed once.
If a for-condition is present, it is evaluated.
174Copyright Microsoft Corporation 1999-2003. All Rights Reserved.