Exiting a FOR/NEXt loop
#2
You EXIT FOR, which moves the program flow at that point to after the NEXT statement. The GOTO never executes.

For x& = 1 To 10
Print x&
If x& = 5 Then Exit For: GoTo stuff
Next x&

PRINT x& ' As you can see here, x& is 5, so you did indeed EXIT the FOR loop.
Print "done"
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)