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

4- 60
{GOTO } [ {
else_line_id
}]
{GO TO}
num_expr
OF
line_id
[,
line_id
]... [ELSE {CONTINUE }]
Parameters
num_expr
A numeric expression that is evaluated and converted to
an integer,
n
. The integer
n
must be between one and
the number of
line_id
s, or an error occurs if no ELSE
clause is present. Control transfers to the
n
th
line_id
.
line_id
A line number or line label of a line that control can
be transferred to. The line specified must be in the
same program unit as the GOTO OF statement.
else line_id
The ELSE clause allows the specification of a line that
control transfers to if the value of
num_expr
is NOT
between 1 and the number of
line_id
s specified.
CONTINUE A keyword that specifies that no branch should be made.
Execution will continue at the next line.
Examples
100 READ I,J
110 GOTO I+J OF One,Two,Three,Four ELSE End_program
140 One: PRINT "One 1"
145 STOP
150 Two: PRINT "Two 2 2"
155 STOP
160 Three: PRINT "Three 3 3 3" !Since I+J =3, this is executed
165 STOP !Program then stops
170 Four: PRINT "Four 4 4 4 4"
175 DATA 1,2
900 End_program: !Executed if I+J is greater than 4
999 END
The ON GOTO statement works like the GOTO OF statement. The following
statements are equivalent:
150 ON I GOTO 10,200,ReInit,Quit
150 GOTO I OF 10,200,ReInit,Quit
GRAD
The GRAD statement indicates that angular units will be specified in
Grads. The default is Radians. A Grad is 1/400 of a circle. This
statement is used with trigonometric functions.
Syntax
GRAD
Example
10 Radius = 10
20 GRAD
30 Area = PI * Radius**2
40 PRINT Area
GRAND TOTALS
The GRAND TOTALS statement provides an easy means for automatic
accumulation of numeric data in the Report Writer. The GRAND TOTALS
statement provides totaling for an entire report.
The GRAND TOTALS statement must appear in the REPORT HEADER, REPORT
TRAILER, or REPORT EXIT section. Each report description can have only