Exiting a FOR/NEXt loop
#1
Hi all. First post. I did post a couple of times on Facebook, but now I'm here.
Okay... I have a FOR/NEXT loop that I want to exit if a certain condition occurs. The thing is, if I put a label for it to go to it doesn't do that. It simply resumes on the next line after the loop. I'm using version 2.02

Code: (Select All)
Cls
For x& = 1 To 10
    Print x&
    If x& = 5 Then Exit For: GoTo stuff
Next x&

Print "done"
here: GoTo here

stuff:
Print "exited loop"
Reply


Messages In This Thread
Exiting a FOR/NEXt loop - by Circlotron - 08-24-2022, 05:40 AM
RE: Exiting a FOR/NEXt loop - by SMcNeill - 08-24-2022, 05:50 AM
RE: Exiting a FOR/NEXt loop - by Circlotron - 08-24-2022, 06:17 AM
RE: Exiting a FOR/NEXt loop - by mnrvovrfc - 08-24-2022, 06:33 AM



Users browsing this thread: 2 Guest(s)