21.11.2014 Views

Programming Manual for Citizen BASIC Interpreter - MaRCo

Programming Manual for Citizen BASIC Interpreter - MaRCo

Programming Manual for Citizen BASIC Interpreter - MaRCo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Citizen</strong> <strong>BASIC</strong> <strong>Interpreter</strong><br />

1030 T=T+C<br />

1040 C=C+1<br />

1041 IF C>10 THEN EXIT<br />

1050 LOOP<br />

1060 PRINT T<br />

Ready<br />

>RUN<br />

55<br />

Ready<br />

3.10.11 GOSUB Statement<br />

【Explanation】<br />

This statement moves execution to the line designated by the line number to get<br />

the execution back to the one immediately after the GOSUB statement with the RETURN<br />

statement.<br />

【Format】<br />

GOSUB line number<br />

【Parameter】<br />

Line number: designate the line number of the line to move its execution<br />

【E.g.】<br />

>LIST<br />

1000 T=0<br />

1010 C=1<br />

1020 FOR C=1 TO 10<br />

1030 GOSUB 1070<br />

1040 NEXT C<br />

1050 PRINT T<br />

1060 END<br />

1070 T=T+C<br />

1080 RETURN<br />

Ready<br />

>RUN<br />

55<br />

Ready<br />

3.10.12 RETURN Statement<br />

【Explanation】<br />

When called with a GOSUB statement, this statement gets execution back to the one<br />

immediately after the GOSUB statement.<br />

【Format】<br />

RETURN<br />

3.10.13 ON – GOTO Statement<br />

【Explanation】<br />

This statement jumps to the designated line according to the value expressed by<br />

the <strong>for</strong>mula.<br />

【Format】<br />

ON <strong>for</strong>mula { GOTO| GOSUB} line number 1 [, line number 2[, line number 3・・・・[, line<br />

number n] ・・・]]<br />

【Parameter】<br />

Formula:<br />

Must be the <strong>for</strong>mula that becomes an integral value<br />

Jumps to the line number corresponding to the value<br />

expressing by the <strong>for</strong>mula<br />

34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!