DocAda(tm) is a productivity tool of KSCE

Prev | Up | ____ | Back | Forward
About DocAda Light: Preface / Preliminary / Help / TOC / Copyright
DocAda Online at the Ada Home: Complete RM95 / Updates / News

5.8 Goto Statements

A goto_statement specifies an explicit transfer of control from this statement to a target statement with a given label.

Syntax

   
       goto_statement ::= goto label_name;

Name Resolution Rules

The label_name shall resolve to denote a label; the statement with that label is the target statement.

Legality Rules

The innermost sequence_of_statements that encloses the target statement shall also enclose the goto_statement. Furthermore, if a goto_statement is enclosed by an accept_statement or a body, then the target statement shall not be outside this enclosing construct.

Dynamic Semantics

The execution of a goto_statement transfers control to the target statement, completing the execution of any compound_statement that encloses the goto_statement but does not enclose the target.

Examples

Example of a loop containing a goto statement:

   
       <<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;

About DocAda Light: Preface / Preliminary / Help / TOC / Copyright
DocAda Online at the Ada Home: Complete RM95 / Updates / News
Prev | Up | ____ | Back | Forward


Copyright © 1994-1997 by Kempe Software Capital Enterprises. All Rights Reserved. For comments on this DocAda(tm) hypertext document, please write to KSCE, at docada@ksce.com