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

4-: 67
array can also be input with the MAT INPUT statement).
See "FOR Clause in Input List" for more information.
Examples
The following examples show several ways to use the INPUT statement.
INPUT
INPUT A,B$,C(*)
INPUT A,B$,C(*):
INPUT:
INPUT: A,B$,C(*)
INPUT: A,B$,C(*):
INPUT A$ A,B$,C(*)
INPUT PROMPT D$; X,Y, PROMPT D1$+D2$, Z
INPUT "Input 2 numbers",X,Y,PROMPT D1$+"A";Z,"Input name",N$:
INPUT: (FOR I=1 TO 10, W(I), WW(I,I))
INPUT "Input A and elements of V"; A, (FOR J=1 TO 5, V[J]):
An INPUT statement that begins with a colon assigns the values in the
input buffer before prompting you for input or reading it from a file.
An INPUT statement that ends in a colon stores unassigned input values in
an input buffer.
An INPUT statement that does not begin or end with a colon empties the
input buffer before prompting for input.
FOR Clause in Input List
An input list can contain a FOR clause. The FOR clause is similar to the
FOR NEXT construct.
Syntax
(FOR
num_var
=
num_expr1
TO
num_expr2
[STEP
num_expr3
],
input_item
[,
input_item
]...)
Parameters
num_var
Assigned the sequence of values:
num_expr1
,
num_expr1
+
num_expr3
,
num_expr1
+(2*
num_expr3
), etc. The
INPUT statement reads one input value for each value of
num_var that is less than
num_expr2
(if
num_expr3
is
positive) or greater than
num_expr2
(if
num_expr3
is
negative).
num_expr1
First value assigned to
num_var
.
num_expr2
Value that
num_var
is compared to before the INPUT
statement reads a value. If
num_expr3
is positive and
num_var
>
num_expr2
, loop execution is terminated. If
num_expr3
is negative and
num_var
<
num_expr2
, the loop
execution is terminated.
num_expr3
Amount that
num_var
increases by at the end of the loop.
The default = 1.
input_item
Same as
input_item
in INPUT statement syntax.
Examples
10 INPUT "Input 4 numbers: ", (FOR I=1 TO 4, A(I)), "Input X: ", X
If you input the underlined values during execution:
Input 4 numbers: