monotouch uses the real HttpWebRequest
[mcs.git] / docs / ecma334 / 15.9.xml
blobd46556dfc700618e09748a7b2bc760dffc939e88
1 <?xml version="1.0"?>
2 <clause number="15.9" title="Jump statements">
3   <paragraph>Jump statements unconditionally transfer control. <grammar_production><name><non_terminal where="15.9">jump-statement</non_terminal></name> : <rhs><non_terminal where="15.9.1">break-statement</non_terminal></rhs><rhs><non_terminal where="15.9.2">continue-statement</non_terminal></rhs><rhs><non_terminal where="15.9.3">goto-statement</non_terminal></rhs><rhs><non_terminal where="15.9.4">return-statement</non_terminal></rhs><rhs><non_terminal where="15.9.5">throw-statement</non_terminal></rhs></grammar_production></paragraph>
4   <paragraph>The location to which a jump statement transfers control is called the target of the jump statement. </paragraph>
5   <paragraph>When a jump statement occurs within a block, and the target of that jump statement is outside that block, the jump statement is said to exit the block. While a jump statement may transfer control out of a block, it can never transfer control into a block. </paragraph>
6   <paragraph>Execution of jump statements is complicated by the presence of intervening try statements. In the absence of such try statements, a jump statement unconditionally transfers control from the jump statement to its target. In the presence of such intervening try statements, execution is more complex. If the jump statement exits one or more try blocks with associated finally blocks, control is initially transferred to the finally block of the innermost try statement. When and if control reaches the end point of a finally block, control is transferred to the finally block of the next enclosing try statement. This process is repeated until the finally blocks of all intervening try statements have been executed. </paragraph>
7   <paragraph>
8     <example>[Example: In the example <code_example><![CDATA[
9 using System;  
10 class Test  
11 {  
12    static void Main() {  
13       while (true) {  
14          try {  
15             try {  
16                Console.WriteLine("Before break");  
17                break;  
18             }  
19             finally {  
20                Console.WriteLine("Innermost finally block");  
21             }  
22          }  
23          finally {  
24             Console.WriteLine("Outermost finally block");  
25          }  
26       }  
27       Console.WriteLine("After break");  
28    }  
29 }  
30 ]]></code_example>the finally blocks associated with two try statements are executed before control is transferred to the target of the jump statement. </example>
31   </paragraph>
32   <paragraph>
33     <example>The output produced is as follows: <code_example><![CDATA[
34 Before break  
35 Innermost finally block  
36 Outermost finally block  
37 After break  
38 ]]></code_example>end example]</example>
39   </paragraph>
40 </clause>