HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

4- 56
If
num_expr3
is positive, and the first value is greater than the last
value, or if
num_expr3
is negative, and the first value is less than the
last value, then the loop is never executed.
20 FOR I=10 TO 1
30 PRINT I !Never executed
40 NEXT I
FOR constructs can be nested.
100 FOR I=1 TO 3 !Outside FOR loop
110 FOR J=1 TO 5 !Inside FOR loop
120 PRINT "*";
130 NEXT J
135 PRINT
140 NEXT I
999 END
The above program prints:
*****
*****
*****
NOTE An error occurs if nested loops have the same loop control variable
(
num_var
).
If you use mixed mode arithmetic on the control variable, the
results can be unpredictable. For example, if I is an integer, and
the STEP value is .1, STEP is rounded to zero.
Entering from a statement other than the FOR statement the body of a FOR
loop causes an error at the NEXT statement, because no FOR statement is
active.
GET KEY
The GET KEY statement's action depends on whether a filename parameter is
included in the statement. If a filename parameter is included and the
file has a BKEY format, then the GET KEY statement defines the fields of
the user-definable keys by obtaining all of the required information from
the file. If the file specified does not have a BKEY format, an error
occurs. If the filename is not specified, then the value of the fields
for the user-defined keys is the value of the fields set during the
previous GET KEY, SCRATCH KEY, or SAVE KEY statement. The default key
set (blank key labels, and the ASCII 7 BEL function) is displayed when
GET KEY is issued without first issuing SCRATCH KEY, SAVE KEY or a GET
KEY.
Syntax
{GET KEY}
{GETKEY } [
fname
]
Parameters
fname
The file that GET KEY uses to obtain information about
the user-definable keys. A file name represented by a
quoted string literal, an unquoted string literal or a
string expression as described in chapter 6.
Examples
GET KEY
GETKEY "keydef" !Uses file Keydef