Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / to exit, or not too exit. thats really not the question.

Author
Message
crighton
18
Years of Service
User Offline
Joined: 5th Nov 2005
Location: In your soup.
Posted: 14th Jan 2006 18:56
The thing i'm wondering is, if i use an exit command in a nestled for/next loop, will it exit both or just ignore the most recent one running.

eg.



Why are the forgotten always remembered? But no-one remembers me?!
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 14th Jan 2006 20:21
well one way to find out is to try it!

i tried it out and as you can see, using exit only exits out of the current loop... (if it exited out of both then "finalx" would be equal to 42)


to exit out of both... you'd have to do something really weird like this...


or another option would be to put the for-next loops in a function by themselves, then to exit both of them you could just use "exitfunction"

--Peter

"We make the worst games in the universe..."
crighton
18
Years of Service
User Offline
Joined: 5th Nov 2005
Location: In your soup.
Posted: 15th Jan 2006 03:06
yeah thats what i thought, its not a problem, as im a newbie still theres some things i confuse myself with.
so i was just curious, thanks.


Why are the forgotten always remembered? But no-one remembers me?!
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 15th Jan 2006 06:37
While you can 'seed' the loop counters for aid in the exit. You could also use the dreaded(to some) "Goto" for your change of control


Ie.


Login to post a reply

Server time is: 2024-09-24 13:23:17
Your offset time is: 2024-09-24 13:23:17