Are you intentionally setting step to 0 and x to 99?
setting the loop iterator manually inside the for loop is always risky business.
Not sure how this basic language tests how the loop is over... since it seems to go on forever and needs a manual break, maybe it checks if x is exactly 10, not 10 or above?
i always set it up internally. assume that you read 100 lines from a file or an array. searching for a specific record. and finding it on the 20. what to do?? i set it over to max value and quiting the search loop. its a requirement..
QuickBasic, TurboBasic and even BASCOM works that correctly by breaking the loop. But interpreters are fails.. i think this is a bug..
i would prefer an "illegal function call" for step 0.
Some Basic languages have a command for popping/breaking out of loops. I think if I'm writing something in basic and can't break out, then I'd probably use a different loop type (like a manual loop such as while/repeat or maybe even goto--I'm not shy.).
What happens if you do a step 1 (and comment out the x=99), then print out X after the loop? Does it clip at 10, or is it now 11 after finishing? Might be interesting to see if the GWBASIC for loop does any clipping. AMOS doesn't it seems.
If step is 1 you are going up to x=10, which the assign to 99 immediately jumps it too high. Step 0 is invalid since there's no increment and the evaluation just happening?
Step is the increment of the variable as the loop..loops?
PrometheusANJ@reddit
Are you intentionally setting step to 0 and x to 99?
setting the loop iterator manually inside the for loop is always risky business.
Not sure how this basic language tests how the loop is over... since it seems to go on forever and needs a manual break, maybe it checks if x is exactly 10, not 10 or above?
CommunityHairy6695@reddit (OP)
i always set it up internally. assume that you read 100 lines from a file or an array. searching for a specific record. and finding it on the 20. what to do?? i set it over to max value and quiting the search loop. its a requirement..
QuickBasic, TurboBasic and even BASCOM works that correctly by breaking the loop. But interpreters are fails.. i think this is a bug.. i would prefer an "illegal function call" for step 0.
PrometheusANJ@reddit
Some Basic languages have a command for popping/breaking out of loops. I think if I'm writing something in basic and can't break out, then I'd probably use a different loop type (like a manual loop such as while/repeat or maybe even goto--I'm not shy.).
What happens if you do a step 1 (and comment out the x=99), then print out X after the loop? Does it clip at 10, or is it now 11 after finishing? Might be interesting to see if the GWBASIC for loop does any clipping. AMOS doesn't it seems.
pinko_zinko@reddit
I've never done basic but I'll try...
If step is 1 you are going up to x=10, which the assign to 99 immediately jumps it too high. Step 0 is invalid since there's no increment and the evaluation just happening?
Step is the increment of the variable as the loop..loops?
C0y0te71@reddit
What happens if you set X=10?
Academic-Shoulder308@reddit
sweet