You need to make use of the Exit command and have the Return outside of the loop, thus...
You can't jump out of the middle of a loop, as the rest of the program would still think it's in one the next time it gets to a Next - provided Blitz will even compile such a program without an error.
The Exit command is used to jump out of any loop (For..Next, Repeat..Until/Forever and While..Wend).
Hope that helps.
Function test() z = False For i = 0 to 30 If i = 15 Then z = True:Exit Next Return z End Function
You can't jump out of the middle of a loop, as the rest of the program would still think it's in one the next time it gets to a Next - provided Blitz will even compile such a program without an error.
The Exit command is used to jump out of any loop (For..Next, Repeat..Until/Forever and While..Wend).
Hope that helps.