Commodore 2001-8 User Manual page 131

Table of Contents

Advertisement

GET
GOSUB
315 FOR V
~
10'N TO 3.410 STEP
SORIR)
340 NEXT V
345 NEXT
350 NEXT V,W
GET A
GET A$
10 GET A$: 1FA$ =" "THEN 10
10 GOSUB 910
B-3
is negative and the new value of the
variable is =>the final value, then the first
statement following the FOR statement is
executed. Otherwise, the statement
following the NEXT statement is executed.
All FOR loops execute the statements
between the FOR and the N EXT at least
once, even in the case like FOR V = 1 TO O.
Note that expressions (formulas) may be
used for the initial, final and step values in
the FOR loop. The variables of the
expressions are computed only once,
before the body of the FOR ...NEXT loop to
terminate. The statement between the FOR
and its corresponding NEXT in both
example above (310) would be
executed 9 times.
Marks the end of a FOR loop.
If no variable is given, matches the most
recent FOR loop.
A single NEXT may be used to match
multiple FOR statements. Equivalent to
NEXT V: NEXT W. Specification the former
way saves 1 byte of BASIC text storage.
Works like INPUT or INPUT# on a single
character basis. Unlike INPUT though, this
function scans the keyboard and does not
wait for carriage return to be pressed. If no
key has been pressed, A$ =" "(null string)
and A=O after executing this statement.
This example stays in a loop untH a key
has been
pressed.
Branches to the specified statement (910)
until a RETURN is encountered; when a
branch is then made to the statement after
the GOSUB. GOSUB nesting is limited to
23 levels.
Subroutines line numbers are searched for
from the beginning of text. To increase
execution speed, define subroutines first
with low line numbers. Fewer digits in line
numbers will also save storage space.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pet 2001-8

Table of Contents