In programming, a variation of the if-then-else statement that is used when several ifs are required in a row. The following C example tests the variable KEY1 and performs functions based on the results.
switch (key1) {
case '+': add(); break;
case '-': subtract(); break;
case '*': multiply(); break;
case '/': divide(); break;
}