08-24-2022, 06:33 AM
(08-24-2022, 06:17 AM)Circlotron Wrote: It certainly did exit the loop. I'm just surprised that it didn't treat the GOTO following the colon as the next instruction and follow it instead. Just now I tried it on QBASIC and it does the same thing. Oh well...This is what you expected the program to do:
Code: (Select All)
Cls
For x& = 1 To 10
Print x&
If x& = 5 Then Exit For
Next x&
If x& = 5 Then GoTo stuff
Print "done"
here: GoTo here
stuff:
Print "exited loop"