Programming Manual for Citizen BASIC Interpreter - MaRCo
Programming Manual for Citizen BASIC Interpreter - MaRCo
Programming Manual for Citizen BASIC Interpreter - MaRCo
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Citizen</strong> <strong>BASIC</strong> <strong>Interpreter</strong><br />
1020 C=C+1<br />
1030 GOTO 1010<br />
1040 STOP<br />
1050 PRINT "FINISH"<br />
2000 END<br />
Ready<br />
>RUN<br />
Stopped at line 1040<br />
Ready<br />
>RESTART<br />
FINISH<br />
Ready<br />
3.10.4 IF Statement<br />
【Explanation】<br />
Judging the conditional expression, this statement executes the statement with the<br />
THEN clause if it is true, and that with the ELSE clause if false.<br />
【Format】<br />
IF conditional expression THEN{ statement| line number} [ELSE{ statement| line<br />
number}]<br />
When designating a line number to the THEN or ELSE clause, jump to the line. The<br />
ELSE clause can be omitted. When the ELSE clause is omitted and the conditional<br />
expression is false, then the execution moves to the next line.<br />
【E.g.】<br />
1010 IF C=10 THEN GOTO 1040<br />
If the value of the variable C is 10, jump to the line number 1040.<br />
1010 IF C=127 THEN C=32<br />
if the value of the variable C is 127, rewrite it to 32.<br />
3.10.5 Structured IF Statement<br />
【Explanation】<br />
Judging the conditional expression, this statement executes the statement with the<br />
THEN block if the result is true, and that with the ELSE block if false. After the<br />
THEN and ELSE blocks are executed, start execution subsequent to ENDIF.<br />
【Format】<br />
IF conditional expression THEN<br />
Statement<br />
[ELSE IF conditional expression THEN<br />
Statement]<br />
[ELSE<br />
Statement]<br />
END IF<br />
ELSE and ELSE IF clauses can be omitted.<br />
【E.g.】<br />
1000 INPUT "(XX)";A$<br />
1010 IF MID$ (A$,1,1 )="0" THEN<br />
1020 PRINT 0;<br />
1030 IF MID$ (A$,2,1 )="0" THEN<br />
1040 PRINT 0;<br />
1050 ELSE<br />
1060 PRINT 1;<br />
1070 END IF<br />
1080 PRINT "-";<br />
30