Commodore 128 Programmer's Reference Manual page 72

Hide thumbs Also See for 128:
Table of Contents

Advertisement

62
COMMODORE 128
50 INPUT "DO YOU WANT TO RUN IT AGAIN (Y/N)";Z$:IF Z$ = "Y"
THEN 10
60 STOP
100 INPUT"ENTER ANOTHER NUMBER (NOT ZERO)";A
110 RESUME 20
j
This example traps a "DIVISION BY ZERO ERROR" in line 20 if 0 is entered in line
J
15. If zero is entered, the program goes to line 100, where you are asked to input another
^
number besides 0. Line 110 returns to line 20 to complete the calculation. Line 50 asks
if you want to repeat the program again. If you do, press the Y key.
J j
RETURN
Return from subroutine
<
RETURN
EXAMPLE:
jj
10 PRINT "ENTER MAIN PROGRAM"
20 GOSUB 100
\ !
30 PRINT "END OF PROGRAM"
I {
90 STOP
^
100 PRINT "SUBROUTINE 1"
110 RETURN
J j
This example calls the subroutine at line 100 which prints the message "SUBROU
TINE 1" and RETURNS to line 30, the rest of the program.
\ j
RUN
Execute BASIC program
i
1) RUN [line number]
2) RUN "filename" [,Ddrive number][<ON|,>Udevice number]
(
EXAMPLES:
L>
RUN
Starts execution from the beginning of the program.
RUN 100 Starts program execution at line 100.
[J
RUN'TRGl"
DLOADs "PRG1" from disk drive 8, and runs it from the
starting line number.
I
RUN(A$) DLOADs the program named in the variable A$.
L

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents