Forum : What is the switch statement ?
Brief description  about Online courses   join in Online courses
View Arun  Desai 's Profile

What is the switch statement ?

switch statement.....
Asked by Arun Desai | Mar 17, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi Arun,
Use the switch statement to select one of many blocks of code to be executed.

switch (n)
{
case label1:
code to be executed if n=label1;
break;
case label2:
code to be executed if n=label2;
break;
default:
code to be executed if n is different from both label1 and label2;
}
Mar 17, 2010