switch statement

(programming)switch statement - (Or case statement, multi-way branch) A construct found in most high-level languages for selecting one of several possible blocks of code or branch destinations depending on the value of an expression. An example in C is

switch (foo(x, y)) case 1: printf

The break statements cause execution to continue after the whole switch statemetnt. The lack of a break statement after the first case means that execution will fall through into the second case. Since this is a common programming error you should add a comment if it is intentional.

If none of the explicit cases matches the expression value then the (optional) default case is taken.

A similar construct in some functional languages returns the value of one of several expressions selected according to the value of the first expression. A distant relation to the modern switch statement is Fortran's computed goto.
Swiss franc
Swiss mountain pine
Swiss people
Swiss pine
Swiss roll
Swiss steak
Swiss stone pine
Switch back
Switch board
switch cane
switch engine
switch grass
switch off
switch on
switch over
-- switch statement --
switchblade knife
switchboard operator
Switched Multimegabit Data Service
switched virtual circuit
switched virtual connection
Switching engine
switching hub
Definitions Index: # A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

About this site and copyright information - Online Dictionary Home - Privacy Policy