Skip to content

Instantly share code, notes, and snippets.

@elucian
Last active March 10, 2022 16:00
Show Gist options
  • Save elucian/3f8c9bb5d501edb15349e367735b509c to your computer and use it in GitHub Desktop.
Save elucian/3f8c9bb5d501edb15349e367735b509c to your computer and use it in GitHub Desktop.
Dart Switch
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