TAL Reference Manual

Statements
TAL Reference Manual526371-001
12-25
GOTO Statement
GOTO Statement
The GOTO statement unconditionally transfers program control to a statement that is
preceded by a label.
label-name
is the identifier of a label that is associated with a statement. It cannot be an entry-
point identifier.
Usage Considerations
A local GOTO statement can refer only to a local label in the same procedure. A local
GOTO statement cannot refer to a label in a subprocedure or in any other procedure.
A sublocal GOTO statement can refer to a label in the same subprocedure or in the
encompassing procedure. A sublocal GOTO statement cannot refer to a label in
another subprocedure.
Examples of GOTO Statements
1. In this example, a local GOTO statement branches to a local label:
PROC p
BEGIN
LABEL calc_a; !Declare local label
INT a;
INT b := 5;
calc_a : !Place label at local statement
a := b * 2;
!Lots of code
GOTO calc_a; !Local branch to local label
END;
2. In this example, a sublocal GOTO statement branches to a local label:
PROC p;
BEGIN
LABEL a; !Declare local label
INT i;
SUBPROC s;
BEGIN
!Lots of code
GOTO
label-name
VST1215.vsd