Champak Posted July 23, 2008 Share Posted July 23, 2008 (edited) I don't want to have to restructure a particular function, so I was wondering if it was possible to get out of a IF condition within a function, BUT continue on with the function. Ex. Func ... IF something then blah blah Endif If something 2 then blah blah 2 If something 3 then exit this if condition AND "something 2" because of whatever reason;<----------- Endif endif ;Continue on within the function endfunc Edited July 23, 2008 by Champak Link to comment Share on other sites More sharing options...
Valuater Posted July 23, 2008 Share Posted July 23, 2008 Absolutely, Yes! ( based on good code ) 8) Link to comment Share on other sites More sharing options...
-Ultima- Posted July 23, 2008 Share Posted July 23, 2008 (edited) You're probably going to need to store some kind of boolean along the lines of: Func If $something Then ;whatever EndIf Local $inner_exit = False If $something_2 then ; blah If $something_3 Then ; reach some condition, set $inner_exit = True EndIf If Not $inner_exit Then ; Rest of $something_2 block EndIf EndIf ; Rest of function EndFunc It's ugly, and can probably be rearranged slightly (depending on what you're trying to do), but that's the general gist of it. This kind of situation is one of the rare times that goto statements can be useful (at least for writing nicer code), but they're not entirely necessary. Edited July 23, 2008 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] Link to comment Share on other sites More sharing options...
Champak Posted July 23, 2008 Author Share Posted July 23, 2008 (edited) @ -Ultima- Thanks, I thought of that, I was just hoping there was something "simpler" than that like "ReturnIF" that I didn't see or some other type of function to interject. But I guess I'll go back to that. Thanks. Edited July 23, 2008 by Champak Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now