switch statement
switch statement
(programming)switch (foo(x, y))case 1: printf
The break statements cause execution to continue after thewhole switch statemetnt. The lack of a break statement afterthe first case means that execution will fall through intothe second case. Since this is a common programming error youshould add a comment if it is intentional.
If none of the explicit cases matches the expression valuethen the (optional) default case is taken.
A similar construct in some functional languages returns thevalue of one of several expressions selected according to thevalue of the first expression. A distant relation to themodern switch statement is Fortran's computed goto.