Commodore 16 User Manual
Download Operation & user’s manual of Commodore 16 Desktop for Free or View it Online on All-Guides.com.
I
'(
LOOP[UNTIL booiean
argumeni WHILE
boolean argument]
(An example
of
a
boolean argumeni
Is A=l or H>-57
)
Performs
the siatemenis
between ihe
DO statement and the LOOP
statement. If no UNTIL or WHILE modifies
either the
DO or the LOOP
statement,
execution of the intervening statements
continues
Indefinitely.
If
an
EXIT
statement is encountered io
the body of
a DO
loop,
execution is transferred
to the first statement lollowing
the LOOP
statement
DO loops may be nested, lollowing
the rules defined for
FOR-NEXT loops.
It
the UNTIL
parameter is used. Ihe program
continues looping until
the
boolean
argument is satisfied
(becomes TRUE).
The WHILE parameter
Is basically
the opposite of the UNTIL
parameter;
the program continues
looping
as
long
as the boolean argument
is
TRUE.
EXAMPLE:
DOUNTTLX-0ORX-1
LOOP
DO WHILE A$="":GET
A$:LOOP
I
DRAW
DRAW
(colour
source
*\ [,
al.
b1][,TOa2,
b2.][ .]
With this command
you can draw Individual
dots, lines, and shapes.
You supply colour source
(0-3). starting (al
, b1 ) and ending poinls
(a2.
b2).
EXAMPLES:
a
dot
DRAW
1. 100, 50
—
no endpolnt specified, defaults
to
a1 ,b1 value tor
a2.b2 to
create
a dot
lines:
DRAW
.
10.10, TO
100,60
DRAW
TO 25,30
a shape: DRAW
,
10,10 TO 10.60 TO
100,60 TO 10,10
(
f
(
I
f
116
I (
( (
I I
I
I
I
<
I
(
I (
I (
I
f
(
I
I
(
( (
I
(
I
. f
(
(
I
.
f
(
f
END
END
When the program executes an END statement, the
program
stops
RUNnlng
Immediately.
You
may
use
the CONT command to
re-start
the
program
at
Ihe statement following the END statemenL
FOR . . . TO . . . STEP
FOR
variable
=
start value
TO
end
value
(STEP
increment]
This statemenl works with the NEXT
statement
to
set
up a
section of
the
program that
repeals for a set
number of times. You may Just want
your computer
to
count
up to a
large number so the program pauses
for
a
few seconds, in case you need something counted, or
something
must be done a
certain
number o'
times
(such as
printing).
The loop
variable
is
the variable that is
added
to or subtracted from
during
the
FOR/NEXT loop. The start value and the end
value are
the
beginning and ending counts tor the loop
variable.
The
logic
ol
Ihe FOR statemenl is
as
loiiows First, the loop variable Is
set to
tne start value. When the program reaches a line with the
command NEXT, it adds tne STEP increment (default 1 ) to the
value
of the loop
variable
and checks to see
If
It Is
higher than the end of loop
value. If It
is not higher, the next line executed is
the statement
immediately
following the
FOR statement.
If the
loop
variable is larger
than
the end of
loop number, then Ihe next statement executed Is the
one following
the
NEXT statement A STEP value can be positive or
negative. See also the NEXT statement.
EXAMPLE'
10 FOR L
-
1 TO 20
20 PRINT L
30 NEXT L
40 PRINT "BLACKJACK!
L
-
"I
117