Switch statement

A switch statement causes control to transfer to one labeled-statement in its statement body, depending on the value of condition. The switch statement body consists of a series of case labels and an optional default label. A labeled-statement is one of these labels and the statements that follow. The labeled statements aren’t syntactic requirements, but the switch statement is meaningless without them. No two constant-expression values in case statements may evaluate to the same value. The default label may appear only once. The default statement is often placed at the end, but it can appear anywhere in the switch statement body. A case or default label can only appear inside a switch statement.
Back to Top