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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

switch and case 1

Status
Not open for further replies.

jayjay60

Programmer
Jun 19, 2001
97
FR
I would like to know if we could use the case method with more than 1 expression. For example, i want to do the same thing for case 1 to 10, another thing for case 11 to 15...
Is it possible?

thanks in advance

jayjay
 
It 9is not like in Visual Basic but you can do something like:

switch(whatever)
{
case 0:
case 1:
case 2:
case 3:
//do something for the interval 0...3
break;
case 6:
case 7:
case 8:
case 9:
//do something for 6...9
break;
....
}

Notice the break instruction position s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darkness...
 
just a thought. If you have such a large range why not use if's?

Matt
 
is up to you. But is much easier notation. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top