Last active
March 10, 2022 16:00
-
-
Save elucian/3f8c9bb5d501edb15349e367735b509c to your computer and use it in GitHub Desktop.
Dart Switch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
void main() { | |
var rng = new Random(); | |
for (int i = 0; i < 21; i++) { | |
var v = rng.nextInt(5); | |
switch (v) { | |
case 1: | |
print("v=$v first case"); | |
break; | |
case 2: | |
print("v=$v second case "); | |
break; | |
case 3: | |
case 4: | |
case 5: | |
print("v=$v between 3 and 5"); | |
break; | |
default: | |
print("v=$v default case"); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment