![]() |
Hi everyone, I have an if then else statement that contains a for loop and another if statement. It also contains another for loop and if statement after the Else part. What I want to do is jump out of the nested if. I've shown below the structure to make it easier to explain.
If For....... If...... .......................... (This is where I want to jump out of all these statements) End If Next ....................... Else For....... If....... ............................ End If Next .................. End If (This is where I want to jump to) ............................. ............................. I know that I can use Exit Sub to jump to the end of the sub, and I know I can use Exit For to jump out of a for loop but they are no use to me here. If anyone knows if it's possible to do what I want, then I could use your help. Cheers |
I think you might have to use *shudder* goto for this one.
|
isn't there a
break; ?? |
There is - Exit For, Exit If or whatever, but he wants to break out of multiple nested statements. You could also set a flag, which it checks and breaks if it's true.
|
make procedure sub ThisIsIWantToJumpTo, and call it where you need. Don't use GOTO, if .Net got it.
|
Quote:
:
bool exitloop = false;edit: doh, i forgot i am now in the VB forums, not c++ anymore. close enough though, you get the picture right? |
| All times are GMT -5. The time now is 3:56 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC