Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple case switch

Status
Not open for further replies.

elfanddot

Programmer
Feb 21, 2002
28
0
0
US
any help is appreciated
i need something like this
swith(a)
case 1 to 5: break;
case 6 to 10: break;

i remember seeing it in school, yet i forgot it!
 
switch(a)
{
case 1:
case 2:
case 3:
case 4:
case 5:
// stuff
break;
case 6:
case 7:
case 8:
case 9:
case 10:
// other stuff
break;
default:
// stuff
break;
}// end switch


BUT why not a simple if, else if, else?
Matt
 
it is currently a if.ifelse.else section
thank you

p.s. the case 1 to 5
was to save typing and reading space!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top