OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 import "package:expect/expect.dart"; |
| 6 |
5 void for1() { | 7 void for1() { |
6 var cond = true; | 8 var cond = true; |
7 var result = 0; | 9 var result = 0; |
8 for (var x = 0; cond; x = x + 1) { | 10 for (var x = 0; cond; x = x + 1) { |
9 if (x == 10) cond = false; | 11 if (x == 10) cond = false; |
10 result = result + x; | 12 result = result + x; |
11 } | 13 } |
12 Expect.equals(55, result); | 14 Expect.equals(55, result); |
13 } | 15 } |
14 | 16 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 80 } |
79 | 81 |
80 void main() { | 82 void main() { |
81 for1(); | 83 for1(); |
82 for2(); | 84 for2(); |
83 for3(); | 85 for3(); |
84 for4(); | 86 for4(); |
85 for5(); | 87 for5(); |
86 for6(); | 88 for6(); |
87 } | 89 } |
OLD | NEW |