Skip to content

Instantly share code, notes, and snippets.

@ntatko
Created June 27, 2022 20:31
Show Gist options
  • Select an option

  • Save ntatko/1039511d46a7a4cbe122064ad6aa3fef to your computer and use it in GitHub Desktop.

Select an option

Save ntatko/1039511d46a7a4cbe122064ad6aa3fef to your computer and use it in GitHub Desktop.
Switch Statements in Dart
/// SWITCH STATEMENTS
void main() {
String food = "Hamburger";
switch (food) {
case "Cheeseburger":
case "Hamburger":
case "Burger":
print("This is a burger");
break;
case "Fries":
print("These are the fries you ordered");
break;
default:
print("We don't serve that here");
break;
}
print("all done ordering");
int number = 10;
switch (number) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
print("only one digit");
break;
default:
print("more than one digit");
return;
}
print("done with numbers");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment