Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 switcher(val) { | |
| 6 var x = 0; | |
| 7 switch (val) { | |
| 8 case 1: | |
| 9 x = 100; | |
| 10 break; | |
| 11 case 2: | |
| 12 x = 200; | |
| 13 break; | |
| 14 case 3: | |
| 15 x = 300; | |
| 16 break; | |
| 17 default: | |
| 18 return 400; | |
| 19 break; | |
|
Lasse Reichstein Nielsen
2012/03/06 08:57:14
That break should be dead code.
ahe
2012/03/06 09:16:50
I know. I noticed this would cause a crash, so I "
| |
| 20 } | |
| 21 return x; | |
| 22 } | |
| 23 | |
|
Lasse Reichstein Nielsen
2012/03/06 08:57:14
Try pushing it a little :)
E.g., something like:
ahe
2012/03/06 09:16:50
Then my code would be untested. I'm not attempting
| |
| 24 main() { | |
| 25 Expect.equals(100, switcher(1)); | |
| 26 Expect.equals(200, switcher(2)); | |
| 27 Expect.equals(300, switcher(3)); | |
| 28 Expect.equals(400, switcher(4)); | |
| 29 } | |
| OLD | NEW |