EasyManua.ls Logo

Radio Shack TRS-80 Model III - Page 166

Radio Shack TRS-80 Model III
274 pages
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...
TRS-80
MODEL
III
Then the
counter is
compared
with the
final
'value
specified in
the FOR
statement.
If
the counter
is greater
than the
final
value,
the loop is
completed and
execution
continues
with the
statement
following
the NEXT statement.
(If
increment
was a
negative number,
loop ends
when
counter is less than
/ma/ value.)
If the
counter has
not
yet
exceeded the
final
value,
control passes
to
the
first statement
after
the FOR
statement.
Example
Programs:
10 FOR
I
=
10
TO
1
STEP
»1
20
PRINT
I;
30
NEXT
READY
>RUN
10
9 8 7
6 5 4 3
2 1
READY
10 FOR
K
=
B TO
1
STEP
.3
20
PRINT
K;
30
NEXT-
READY
>RUN
.3
.6
.9
READY
After
K
=
. 9
is
incremented
by .
3
, K
=
1 . 2 . This is
greater than
the
final
value
1
,
therefore
loop ends
without
ever printing//«a/
value.
10 FOR K
=
4 TO
20
PRINT
K;
30
NEXT
READY
>RUN
4
READY
No
STEP is specified,
so
STEP
1
is
assumed. After
K
is
incremented
the first
time,
its
value is
5
.
Since
5
is greater
than
the
final
value
0,
the
loop ends
.
10 J
=
3:
K
=
"
o
" L.
=:
k!
20
FOR
I
=
J
TO K
+
1
STEP L
30 J
=
0:
K
=
=
0:
L
=
=
40
PRINT I
"
50
NEXT
READY
>RUN
3
5
7 9
READY
156

Other manuals for Radio Shack TRS-80 Model III

Related product manuals