| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 nestedForLoopWithBreakAndContinue(count) { | 5 nestedForLoopWithBreakAndContinue(count) { |
| 6 /*0@continue*/ for (int i = 0; i < count; i = i + 1) { | 6 /*0@continue*/ for (int i = 0; i < count; i = i + 1) { |
| 7 /*1@break*/ for (int j = 0; j < count; j = j + 1) { | 7 /*1@break*/ for (int j = 0; j < count; j = j + 1) { |
| 8 if (i % 2 == 0) /*target=1*/ break; | 8 if (i % 2 == 0) /*target=1*/ break; |
| 9 } | 9 } |
| 10 if (i % 2 == 0) /*target=0*/ continue; | 10 if (i % 2 == 0) /*target=0*/ continue; |
| 11 } | 11 } |
| 12 } | 12 } |
| 13 | 13 |
| 14 nestedForLoopWithLabelledBreak(count) { | 14 nestedForLoopWithLabelledBreak(count) { |
| 15 outer: | 15 outer: |
| 16 /*0@break*/ | 16 /*0@break*/ |
| 17 for (int i = 0; i < count; i = i + 1) { | 17 for (int i = 0; i < count; i = i + 1) { |
| 18 for (int j = 0; j < count; j = j + 1) { | 18 for (int j = 0; j < count; j = j + 1) { |
| 19 if (i % 2 == 0) /*target=0*/ break outer; | 19 if (i % 2 == 0) /*target=0*/ break outer; |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 | 23 |
| 24 nestedForLoopWithLabelledContinue(count) { |
| 25 outer: |
| 26 /*0@continue*/ |
| 27 for (int i = 0; i < count; i = i + 1) { |
| 28 for (int j = 0; j < count; j = j + 1) { |
| 29 if (i % 2 == 0) /*target=0*/ continue outer; |
| 30 } |
| 31 } |
| 32 } |
| 33 |
| 34 nestedForLoopWithLabelledBreakAndContinue(count) { |
| 35 outer: |
| 36 /*0@break,continue*/ |
| 37 for (int i = 0; i < count; i = i + 1) { |
| 38 for (int j = 0; j < count; j = j + 1) { |
| 39 if (i % 2 == 0) /*target=0*/ break outer; |
| 40 if (i % 3 == 0) /*target=0*/ continue outer; |
| 41 } |
| 42 } |
| 43 } |
| 44 |
| 24 main() { | 45 main() { |
| 25 nestedForLoopWithBreakAndContinue(10); | 46 nestedForLoopWithBreakAndContinue(10); |
| 26 nestedForLoopWithLabelledBreak(10); | 47 nestedForLoopWithLabelledBreak(10); |
| 48 nestedForLoopWithLabelledContinue(10); |
| 49 nestedForLoopWithLabelledBreakAndContinue(10); |
| 27 } | 50 } |
| OLD | NEW |