Basic Syntax

switch Statement

English

Overview

A control construct that branches into multiple paths based on a single value.

Details

A control construct that jumps to one of several branches based on the value of an expression, letting many conditional branches be written more clearly than a chain of if-else. In many C-family languages, forgetting a break at the end of a case lets execution fall straight through into the next case -- a classic bug known as fall-through.

More Programming terms