- 2.2.9.5. -
Table of Contents
2. TMT Pascal Language Description
2.2. Pascal Language Structure
2.2.9. Statements
2.2.9.5. Goto Statement
2.2.9.5. Goto Statement
As mentioned above statements may be preceded by labels. The goto
statement transfers control to a specific label.
The format of a goto statement is as follows:
goto label;
where label has been previously declared in the current block.
The following is an example of the goto statement:
label GotoLoop;
var
i: Integer;
begin
i := 1;
GotoLoop:
WriteLn(i);
Inc(i,2);
if i < 100 then goto GotoLoop;
end.
- 2.2.9.5. -