123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|160|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> JSE -> For loop bug

Sun, 13 Nov 2022, 05:10
Dan

For loop bug


See the example:
  --v

Sun, 13 Nov 2022, 05:23
Jayenkai
And I can tell you exactly why that happens, too.

Every For-Next gets turned into a Repeat-Until by the parser.

For x=y becomes x=y:Repeat. The code then extracts the "To ..." bit, and hunts for what it thinks is the connecting Next.
There, it replaces the Next with
x=x+"Step":Until x>y
(or, if Step is a negative, replaces it with x<y)

Because of this, it'll always do that first pass.
I DO need to fix that, but the only real way I can think to do it, is to switch out the Repeat-Until for a While-Wend.
That'd be MUCH better, but unfortunately I haven't yet done that, because trying to guesstimate which Wend connects to a While, so that it can jump to the Wend without passing through the middle, isn't something I've worked out in my head yet!!!

(See also.. There's no While/Wend!!)

When the code is running, it's easier to say Repeat: Until - Jump Back to the point in the stack... than it is to say While - Jump to the bit you haven't got to yet...
If that makes sense..!

I do need to fix this, though, it's been a bug since the very start.

-=-=-
''Load, Next List!''