Appendix
G:
BASIC
Statements 34 7
The start, end, and increment values are read only once, on the first
execution of the FO R statement. You cannot change these values inside the
loop. You can change the value
of
nvar within the loop. This may be used to
terminate a FOR-NEXT loop before the
end
value
is
reached: Set nvar to
the
end
value and on the next pass the loop will terminate itself. Do not jump
out
ofthe
FOR-NEXT loop with a GOTO.
Do
not start the loop outside a
subroutine and terminate it inside the subroutine.
FOR-NEXT loops may be nested. Each nested loop must have a
different
nvar variable name. Each nested loop must be wholly contained
within the next outer loop;
at
most, the loops can end at the same point.
GET
The GET statement receives single characters as input from the
keyboard.
Format:
GETvar
The GET statement can be executed in program mode only. When a
GET statement
is
executed, var
is
assigned a 0 value if numeric,
or
a null
value if a string. Any previo'us value
ofthe
variable
is
lost. Then GET fetches
the next character from the keyboard buffer and assigns it to
var.
If
the
keyboard buffer
is
empty,
var
retains its 0 or null value.
GET
is
used to handle one-character responses from the keyboard.
GET accepts the
RETURN
key as input and passes the value (CHR$(13)) to
var.
If
var
is
a numeric variable and no key has been pressed, 0
is
returned.
However, a 0
is
also returned when 0
is
entered at the keyboard.
If
var
is
a numeric variable and the character returned
is
not a digit
(0-9), a ?SYNT AX
ERROR
message
is
generated and the program aborts.
The GET statement may have more than one variable in its parameter
list, but it
is
hard to use if it has multiple parameters.
GET var, var, ... , var
Example:
10
GET
C'
18
GET
D
if)
GET
AlBIC