Language | Libraries | Comparison
Just like If statements, switch case statements help the control and flow of the programs. Switch case's allow you to make a list of "cases" inside a switch bracket in which arduino will find the most suitable and run it.
switch (var) {
case 1:
//do something when var == 1
break;
case 2:
//do something when var == 2
break;
default:
// if nothing else matches, do the default
}
Corrections, suggestions, and new documentation should be posted to the Forum.