Archive for the ‘jump statements’ Category

switch statement

July 28th, 2010 c# No comments

The syntax of the switch statement is a bit peculiar. Its objective is to check several possible constant values for an expression. Something similar to what we did at the beginning of this section with the concatenation of several if and else if instructions. Its form is the following:

switch (expression)
case constant1:
group of statements 1;
case constant2:
group of statements 2;
default group of statements

Categories: jump statements Tags: