Showing posts with label switch. Show all posts
Showing posts with label switch. Show all posts

Friday, February 8, 2013

Excercise between W1 and W3

Week-3: 3.4: Switch Statement


Switch:

Another way to control the flow of your programs is with something called a switch
statement. A switch statement gives you the option to test for a range of values for
your variables. They can be used instead of long, complex if … else if statements. The
structure of the switch statement is this:

switch ( variable_to_test ) {
case value:
code_here;
break;
case value:
code_here;
break;
default:
values_not_caught_above;

}

Visit for Details