Loop Command (For·next) - Radio Shack TRS-80 PC-4 Owner's Manual

Trs-80 pc-4
Hide thumbs Also See for TRS-80 PC-4:
Table of Contents

Advertisement

"TH EN" or " ;
I f
(semicolon) are used separately depending upon what follows.
5-6-5 Loop Command
FOR-NEXT
statement
A FOR"NEXT statement is used when you want to perform similar operations
repeatedly and the number of repetitions (loops) is known.
Format: FOR
variable
= n
TO
m
[STEP
R-,]
T
-I
~
initial
final
increment
value
value
NEXT variable
(Item enclosed in brackets may be omitted.)
(n, m and
Q
are numerical expressions.)
In other words, this is a command to repeatedly execute the command between "FOR"
and "NEXT" while a variable changes from
n
to
m
in increments of
Q.
When execution reaches
m,
it proceeds to the command following "NEXT".
-49-

Advertisement

Table of Contents
loading

Table of Contents