Showing the changes to examples/ctrl/ctrl_continue.ck (1 of 486 files). Show all
Unified · Split
| @@ -0,0 +1,27 @@ | ||
| 1 | +// continue in nested block | |
| 2 | + | |
| 3 | +0 => int j; | |
| 4 | +0 => int i; | |
| 5 | +0 => int check; | |
| 6 | + | |
| 7 | +// loop | |
| 8 | +while ( j < 5 ) | |
| 9 | +{ | |
| 10 | + 0 => i; | |
| 11 | + while ( i < 5 ) | |
| 12 | + { | |
| 13 | + 1 +=> i; | |
| 14 | + if ( j < 4 ) continue; | |
| 15 | + | |
| 16 | + // because of continue, this only happens in last ( j==0 ) | |
| 17 | + 2 +=> check; | |
| 18 | + } | |
| 19 | + | |
| 20 | + // if continue malfunctions, this is skipped, and we get INFINITE LOOP | |
| 21 | + 1 +=> j; | |
| 22 | +} | |
| 23 | + | |
| 24 | +// make sure that continue does the right thing in the inner loop? | |
| 25 | +if ( check == 10 ) <<<"success">>>; | |
| 26 | + | |
| 27 | + | |