Commodore 16 User Manual
Download Operation & user’s manual of Commodore 16 Desktop for Free or View it Online on All-Guides.com.
This program prints Ihe numbers from one lo twenty on Ihe screen,
lollowed
by Ihe message BLACKJACK! L 21
.
The end of loop value may
be
lollowed
by (he
word STEP and
another
number or variable In this case, Ihe value following ihe STEP is
added
each lime instead ol one. This allows you lo count backwards, by
fractions, or any
way necessary.
You can set
up
loops inside one another. This Is known
as
nesting
loops. You must be careful to nest loops so that the last loop
to
start is
the first
one to end.
EXAMPLE OF
NESTED LOOPS
[
10
FOR L
=
1 TO 100
20 FOR A
=
S TO 11 STEP 2
30
NEXT
A
40 NEXT L
TiisHDR.
NEXT
loop
ts "nested
1
'
inside
Ihe larger one.
GET
GET variable list
The GET
statement
is
a way to get data from the Keyboard one
character
at a
time When the GET Is
executed, the
character
that was
typed Is received If no character was typed, 'hen
a
null (empty)
character is
returned, and the program continues without
waning
for
a
key There is no need
to press
tne
return key. and m
fact the
hetuum key can
be
received with
a
GET
118
f
'I
I (
: I
i
r
i
i
i i
i i
i
1
i
i
i
i
i
i
1
i
i
i
i
1
<
' (
i
i
i i
i
<
i
i
i
i
i
t
I . !
I
(
The word GET Is followed by a variable
name,
usually a
string variable,
tf
a
numeric were
used
and
any key other
than
a
number
was
hit,
the
program would stop with an error message. The GET statement may
also be put into a loop, checking
for
an empty result,
which
waits
for
a
key lo be struck to continue.
The
GETKEY statement
could
also be
used
in this
case.
This command can only
be
executed within
a
program.
EXAMPLE.
10
GET A$:IF A$
"A"
THEN
10 This line
warts
for the
'A' key to be
pressed
to
continue,
GETKEY
GETKEY variable list
The GETKEY statement Is very similar
lo the GET
staiement. Unlike
the GET statement. GETKEY waits for Ihe user to type a character on
the keyboard This lets it
be used
easily
to
wait tor
a
single character to
be typed,
This command can only
be executed
within
a
program.
EXAMPLE:
10
GETKEY
AS
This line waits tor a key to be
struck. Typing any key
will
continue
the
program
GET
GET*
file number,variable list
111