Closed ukcroupier closed 2 years ago
Hi!
Had something happen that I wasn't expecting,
i=0 for i=i+1 to i+5 ?i;","; next
I was expecting 1,2,3,4,5, but got 1,2,3,4,5,6,
Clearly i is incrementing before getting to 'to i+5' but this isn't how I'd expect this to work (Atari BASIC does it how I would expect)
Yes. FastBasic transforms the above code into:
I = I + 1
for_limit = I + 5
for_step = 1
WHILE I < for_limit
? I;",";
I = I + for_step
WEND
BUT, Atari BASIC and Turbo BASIC XL both do the same, they first assign the new value to the variable and then evaluate the FOR limit and step, just test your code, will print 1,2,3,4,5,6.
Have Fun!
Sorry, you're right. Atari BASIC does do it the same way, I must have miss coded my test.
Thanks for your time.
No problem, Have Fun!
Had something happen that I wasn't expecting,
i=0 for i=i+1 to i+5 ?i;","; next
I was expecting 1,2,3,4,5, but got 1,2,3,4,5,6,
Clearly i is incrementing before getting to 'to i+5' but this isn't how I'd expect this to work (Atari BASIC does it how I would expect)
Not a big problem but though I'd mention it :)