Switch statement

In computer programming, a switch statement is a selection control flow mechanism that changes execution control based on the value of an expression (i.e. evaluation of a variable). A switch statement is similar to an if statement but instead of branching only on true or false, it branches on any number of values. Although the syntax varies by programming language, most imperative languages provide a statement with the semantics described here as the switch statement. Often denoted with the keyword switch, some languages use variations such as case, select, or inspect.