EasyManua.ls Logo

Commodore Plus 4 - Page 85

Commodore Plus 4
234 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Another
example,
with
a
negative
STEP
10
PRINT
"COUNTDOWN..."
20
FOR
J =
10
TO
0
STEP
1
30
PRINT
"WE ARE
AT";J
40
NEXTJ
50
PRINT
"WE
HAVE
LIFT-OFF
AT"
;
J
Statement
Name:
DO
UNTIL/WHILE...
LOOP
UNTIL/WHILE
Format:
DO
UNTIL
[conditionl
WHILE
[condition]
some
BASIC
statements
I
EXIT]
LOOP
UNTIL
{condition]
WHILE
[condition]
The
DO,
LOOP
statement
combination
is
another
way
to
create
a
loop.
This
statement
combination
is
very
powerful
and
versatile.
The
DO.'LOOP
method
of
loops
is
a
common
technique
of
structured
programming
languages.
In
this
chapter
we'll
discuss
just
a
few
possible
uses.
If
you
want
to
create
an
infinite
loop,
just
start
a
section
of
program
lines
with
DO, and end
it
with
a
LOOP
statement,
like this
100
DO:
PRINT
"GOING
UP"
110
LOOP
Press
the
STOP
key
to
end
the
program.
A
more
useful
form
is
to
combine
the
DO;
LOOP
with
the
UNTIL
statement.
The
loop
will
run
continually
unless
the
condition
for
UNTIL
happens.
100
DO:
INPUT
"DO
YOU
LIKE
YOUR
COMPUTER'1
;A$
110
LOOP
UNTIL
A$="YES"
120
PRINT
"THANK
YOU"
For
the
other
ways
you can use
the
DO;
LOOP,
seethe
BASIC
Encyclopedia
at
the
end
of
this
book
H
78

Other manuals for Commodore Plus 4

Related product manuals