- switch
- case
- break
switch case
Only works on numbers and strings. Last statement of each non-empty case must be one of: break, continue, return or throw.
examples/dart-intro/switch_case.dart
main() { var operator = '+'; var a = 23; var b = 19; var c; switch(operator) { case '+' : c = a + b; break; case '-' : c = a - b; break; default: throw("Unknown operator $operator"); } print(c); }