4 ms·
”This is why on most BASICS we always left out the variable, most BASICs would "automatically" loop to the outermost FOR” Innermost (https://www.c64-wiki.com/w
by Someone 7y ago
”This is why on most BASICS we always left out the variable, most BASICs would "automatically" loop to the outermost FOR”
Innermost (https://www.c64-wiki.com/wiki/NEXT https://www.c64-wiki.com/wiki/NEXT, https://en.wikibooks.org/wiki/Visual_Basic/Loops#Nested_Loops https://en.wikibooks.org/wiki/Visual_Basic/Loops#Nested_Loop...)
Also, I don’t think that solves the fundamental problem that (edit: you can get very close. If you maintain a stack of ‘for loop contexts’, NEXT without loop variable name(s)) is little more than an indirect jump), in Basic, for loops don’t introduce a scope, making ‘innermost’ not really a thing (“most recently encountered” is a better way to phrase it)
My Basic is very rusty, but I think this is valid in a classic Basic interpreter:
10 input f
20 if f = 0 goto 50
30 for i = 1 to 10
40 goto 60
50 for j = 1 to 25
60 print “foo”
70 next
Whole-program analysis likely can convert most, if not all, uses of NEXT to jumps in ‘normal’ code, but fitting that in 14 kB may be problematic.