IF...THEN program structure
A few comments:
1. Can I suggest that you use more meaningful label names. For example, in place of
label_1: use Initialise:
label_2 use Main:
label_3: use Check:
2 With respect to the IF … THEN statement,
As a single line statement, you can only put a flow redirection after the THEN keyword.
So, GOTO and GOSUB followed by a label name are okay.
You can use a colon as a new line indicator.
Hence you lines like this are okay:
Code:
label_35:
if b5=10 then gosub label_9
if b1=1 then gosub label_10
if b1=2 then gosub label_11
if b1=3 then gosub label_12
if b1=4 then gosub label_13
if b1=5 then gosub label_14
But for the lines like this they need reworking:
Code:
label_2:
if b0=0 then let b2=1
if b1=0 then let b3=1
if b0=7 then let b2=-1
Two ways to rework them:
Code:
IF b0 = 0 THEN
b2 = 1
ENDIF
or
Code:
IF b0 = 0 THEN : B2 = 1 : ENDIF