2 <section id="statements">
4 <section id="selection">
5 <h>Selection statements</h>
6 <p>The if statement selects a statement for execution based on the value of a boolean expression.</p>
9 <l>if (</l> boolean-expression <l>)</l> embedded-statement
10 <l>if (</l> boolean-expression <l>)</l> embedded-statement <l>else</l> embedded-statement
13 <section id="iteration">
14 <h>Iteration statements</h>
15 <p>The while statement conditionally executes an embedded statement zero or more times.</p>
18 <l>while (</l> boolean-expression <l>)</l> embedded-statement
20 <p>The do statement conditionally executes an embedded statement one or more times.</p>
23 <l>do</l> embedded-statement <l>while (</l> boolean-expression <l>) ;</l>
25 <p>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.</p>
28 <l>for (</l> [for-initializer] <l>;</l> [for-condition] <l>;</l> [for-iterator] <l>)</l> embedded-statement
31 local-variable-declaration
32 statement-expression-list
38 statement-expression-list
40 statement-expression-list:
42 statement-expression-list <l>,</l> statement-expression
44 <p>Within the embedded statement of a for statement, a break statement can be used to transfer control to the end point of the for statement (thus ending iteration of the embedded statement), and a continue statement can be used to transfer control to the end point of the embedded statement (thus executing another iteration of the for statement).</p>
45 <p>The foreach statement enumerates the elements of a collection, executing an embedded statement for each element of the collection.</p>
48 <l>foreach (</l> type identifier <l>in</l> expression <l>)</l> embedded-statement
52 <h>Jump statements</h>
53 <p>The break statement exits the nearest enclosing switch, while, do, for, or foreach statement.</p>
58 <p>The continue statement starts a new iterataion of the nearest enclosing while, do, for, or foreach statement.</p>
63 <p>When multiple while, do, for, or foreach statements are nested within each other, a continue statement applies only to the innermost statement. If a continue statement is not eclosed by a while, do, for, or foreach statement, a compile-time error occurs.</p>
64 <p>The return statement returns control to the caller of the function member in which the return statement appears.</p>
67 <l>return</l> [expression] <l>;</l>
69 <p>The throw statement throws an exception.</p>
72 <l>throw</l> expression <l>;</l>
77 <p>The try statement provides a mechanism for catching exceptions that occur during execution of a block. Furthermore, the try statement provides the ability to specify a block of code that is always executed when control leaves the try statement.</p>
80 <l>try</l> block catch-clauses
81 <l>try</l> block [catch-clauses] finally-clause
85 [specific-catch-clauses] general-catch-clause
87 specific-catch-clause:
89 specific-catch-clauses specific-catch-clause
91 specific-catch-clause:
92 <l>catch (</l> error-type identifier <l>)</l> block