HP Pascal/iX Reference Manual (31502-90022)

6-: 16
NOTE The use of the non-local label form of GOTO may increase execution
time of the program.
Syntax
Goto_statement
Example
PROGRAM show_goto (output);
LABEL 500, 501;
TYPE
index = 1..10;
VAR
i: index;
target: integer;
a: ARRAY[index] OF integer;
PROCEDURE check;
VAR
answer: string [10];
BEGIN
.
{ ask user if OK to search }
IF answer= 'no' THEN GOTO 501; { jumping out of procedure }
.
END;
BEGIN { show_goto }
.
check;
.
FOR i := 1 TO 10 DO
IF target = a[i] THEN GOTO 500;
writeln (' Not found');
GOTO 501;
500:
writeln (' Found');
501:
END. { show_goto }
Procedures
A
procedure statement
transfers program control to the block of a
declared or standard procedure. After the procedure has executed,
control is returned to the statement following the procedure call. A
procedure statement consists of a procedure identifier and, if required,
a list of actual parameters in parentheses.
The
procedure identifier
must be the name of a standard procedure or a