Switch Statement **SOLVED**
Hey all,
this is really emberassing :blush:
I want to use a switch statement to check for some Integer values
Code:
switch (x)
{
case 0:
doSomething();
break;
case 1:
doSomethingElse();
default:
doNothing();
break;
}
This is working. But is there a way that I can have more than one Integer inside my case Statement?
Like
Code:
switch (x)
{
case 0,1,2:
doSomething();
break;
case 2,3,4:
doSomethingElse();
default:
doNothing();
break;
}
Thanks for the help!
Stephan
Re: Switch Statement **SOLVED**
Yes you can. Don't think you can have ranges like case10-20, but it should really be possible. Maybe it is though...but I am to tired to look it up...:)
- ØØ -
Re: Switch Statement **SOLVED**
sadly though, it looks like the control can only fall through if you don't have any line of code in the case block. I was looking for a fix of this before. :(