swtich case in arduino code example
Example 1: swich case arduino
// Arduino => c++
switch (var) {
case 1:
//do something when var equals 1
break;
case 2:
//do something when var equals 2
break;
default:
// if nothing else matches, do the default
// default is optional
break;
}
Example 2: arduino switch case
switch (var) {
case label1:
// statements
break;
case label2:
// statements
break;
default:
// statements
break;
}