Table of Contents
Get Started
Dart Installation
Dartpad
Local Setup
Comments in Dart
Variables
Numbers in Dart
Double in Dart
Integer in Dart
String in Dart
Operation on String
String Interpolation
Boolean in Dart
Operator
Decision Making
Switch in Dart
Ternary Operator
Loops
List in Dart
Operation on List
Map in Dart

Switch in Dart #
In last lesson you learned about the decision making using if else. There is one more way of making decision in programming.
In if
we can compare any two variables and make decision. You can also say if else
works using bool
data.
switch
case works base of comparison of two data of same data types. You can’t do less than or greater than comparison or not equal to comparison. You have to do equal to comparison.
void main(){
int input = 2;
switch(input){
case 1 : print("Input is 1");
break;
case 2 : print("Input is 2");
break;
case 3 : print("Input is 3");
break;
default : print('No case match');
}
}