A branch may not cause control to be transferred into or out of a subprogram or user defined function. In order to branch to different lines depending on the value of an expression, use the on goto statement.
for i = 1 to 5 print i nextcould be written as
i = 1 loop: if i > 5 then end print i i = i + 1 goto loopBoth produce the output
1 2 3 4 5The first program is preferable because constructs such as for...next are inherently clearer than equivalent code using goto branches.
from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber