Arduino Switch/Case

This example illustrates the Arduino syntax for creating a switch which has different cases for different values of a variable.
More information can be found here.

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;
  }