5.8 Goto Statements
1
[A
goto_statement
specifies an explicit transfer of control from this
statement
to a target statement with a given label.]
Syntax
2
goto_statement ::= goto label_name;
Name Resolution Rules
3
Legality Rules
4
4.a
4.b
It follows from the second rule that if the
target
statement
is enclosed by such a construct, then the
goto_statement
cannot be outside.
Dynamic Semantics
5
6
Examples
7
Example of a loop
containing a goto statement:
8
<<Sort>>
for I in 1 .. N-1 loop
if A(I) > A(I+1) then
Exchange(A(I), A(I+1));
goto Sort;
end if;
end loop;
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe