Commodore PET User Manual page 98

Table of Contents

Advertisement

Only one line number is needed for multiple statements placed on one
line.
ln immediate mode. Vou must put multiple statements on one line. If vou at-
tempted to enter the display program one statement at a time, the result would
not be the sa me. Look at the following example:
C$="W"
READ'T'.
FOR 1=1 TO
800
READ'T'.
?C$
W
READ'T'.
HEXT
READY.
?"PHEWJ"
PHEWI
READ'T'.
~
The first statement can be entered separately. since variable assignments
are stored. But just one W is printed, instead of twenty lines of W·s. because the
FOR. , . NEXT loop statements are not executed as a unit. In immediate mode. the
PET executes one line with no memory of what the previous line was, The only
successes were the assignment statement C$="A" and the ?"PHEW''', ln im-
mediate mode vou do access to the current values of ail variables. Colons can be
used to execute "mini-programs" up to
80
characters (two display lines) long in
immediate mode,
ln program mode, putting multiple statements on one line is handy for some
uses. but is indispensable in only one case.
Where two. or sometimes more. statements perform a single operation. they
can optionally be placed on one line and separated by colons:
10
GET
(:$;
1F
(:$=""
GOTO
11' : :1
or
11' : :1
GET
(:$
20
IF
(:$=""
GOTO
10
The only case in a stored program where multiple statements on one line are
treated differently than the same statements on separate lines is with an IF state-
ment. Multiple statements appearing after the IF ... TH
EN
statement are ex-
ecuted only where the IF condition is satisfied. Consider the following line:
50 IF A=0 THEN B=(:;(:=C+l
85

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents