Add variable storage (scalar and array), program line storage with RUN/LIST/NEW, and full control flow: FOR/NEXT, GOTO, GOSUB/RETURN, IF/THEN/ELSE, WHILE/WEND, ON GOTO/GOSUB, DATA/READ/RESTORE. New modules: interp.c (1445 lines - execution loop and statement dispatcher), vars.c, arrays.c, input.c. Version bumped to 0.2.0. 16 test programs pass including Leibniz pi and prime sieve.
9 lines
233 B
QBasic
9 lines
233 B
QBasic
10 REM IF/THEN/ELSE test
|
|
20 X = 5
|
|
30 IF X > 3 THEN PRINT "X > 3" ELSE PRINT "X <= 3"
|
|
40 IF X < 3 THEN PRINT "X < 3" ELSE PRINT "X >= 3"
|
|
50 REM IF with GOTO
|
|
60 IF X = 5 THEN GOTO 80
|
|
70 PRINT "Should not print"
|
|
80 PRINT "Jumped to 80"
|