hello all,
say for example I have a switch() inside of a while(), and in one the the cases of my switch(), I use a break statement:
that would break from the while loop, would it not? I'm in a situation here, because I don't know how I can break the case without breaking the loop. my cases are all very different, I must break from each of them somehow (execution can't "fall through"). I am using the switch() statement instead of a bunch of else ifs, which I would like to avoid using as much as possible (I have alot of conditions to test against).Code:while(blah) { switch(blah) { case BLAH: break; } }
I am thinking maybe I can change the loops conditional test (to something that will remain true after each case) and use a continue at the end where I would use the break in the case to jump to the loops conditional test and continue with the switch() (if of course the loop's test is still TRUE). but I am wondering if the continue will work on the loop if I place it inside a switch case like that?
if anyone could please help me here, it would be appreciated. thankyou in advance!