You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have IF ... ELSE ... THEN, and we can make their statements into blocks with BEGIN ... BEND. However, for some reason ELSE comes with syntax restrictions that prevents ELSE IF from working properly. We should look into this.
10 X=1
20 IF X=0 THEN BEGIN
30 PRINT "ZERO"
40 BEND:ELSE IF X=1 THEN BEGIN
50 PRINT "ONE"
60 BEND:ELSE IF X=2 THEN BEGIN
70 PRINT "TWO"
80 BEND
This prints "ONE" and "TWO". It should only print "ONE".
The documentation for ELSE implies a bunch of odd syntax restrictions. If this is an inherent limitation, we should try to understand and document it better.
The text was updated successfully, but these errors were encountered:
Notably, it is expected behavior for BEND to demarcate a line, not a statement position. The rest of the line is ignored. It's counterintuitive but it has existed since BASIC 7.
Also notably, putting the ELSE IF clauses on separate lines from the BENDs doesn't fix the issue.
We have IF ... ELSE ... THEN, and we can make their statements into blocks with BEGIN ... BEND. However, for some reason ELSE comes with syntax restrictions that prevents ELSE IF from working properly. We should look into this.
This prints "ONE" and "TWO". It should only print "ONE".
The documentation for ELSE implies a bunch of odd syntax restrictions. If this is an inherent limitation, we should try to understand and document it better.
The text was updated successfully, but these errors were encountered: