cpp/language/switch

Transfers control to one of several statements, depending on the value of a condition.

Explanation
The body of a switch statement may have an arbitrary number of labels, as long as the values of all  are unique (after conversions/promotions). At most one label may be present (although nested switch statements may use their own  labels or have  labels whose constants are identical to the ones used in the enclosing switch).

If evaluates to a value that is equal to the value of one of s, then control is transferred to the statement that is labeled with that.

If evaluates to a value that doesn't match any of the  labels, and the  label is present, control is transferred to the statement labeled with the  label.

If evaluates to a value that doesn't match any of the  labels, and the  label is not present, then none of the statements in the switch body is executed.

The statement, when encountered in  exits the switch statement:

Because transfer of control is of a variable, if a declaration statement is encountered inside the, it has to be scoped in its own compound statement:

Keywords
, ,