GOTO OF [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
GOTO OF
The GOTO OF statement transfers control to one of several lines,
depending on the value of a numeric expression. Although this statement
can be entered as either GOTO OF or GO TO OF, HP Business BASIC/XL will
always list it as GOTO OF.
Syntax
{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_ids, or an error occurs if no ELSE
clause is present. Control transfers to the nth
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_ids 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
MPE/iX 5.0 Documentation