User Tools

Site Tools


goto_go_to_a_label_.htm
Navigation:  Language Reference > 12 - Execution Control > Execution Control Statements >====== GOTO (go to a label) ====== Previous pageReturn to chapter overviewNext page

 

GOTO target

blk2blue.jpg

GOTO Unconditionally transfers program control to another statement.
target The label of another executable statement within the PROGRAM, PROCEDURE, or ROUTINE.

The GOTO statement unconditionally transfers control from one statement to another. The target of a GOTO must not be the label of a ROUTINE or PROCEDURE.

The scope of GOTO is limited to the currently executing ROUTINE or PROCEDURE–it may not target a label outside the ROUTINE or PROCEDURE in which it is used.

Extensive use of GOTO is generally not considered good structured programming practice. LOOP is usually considered a better alternative.

Example:

ComputeIt PROCEDURE(Level)

CODE

IF Level = 0

GOTO PassCompute                     !Skip rate calculation if no Level

END  

Rate = Level * MarkUp                 !Compute Rate

RETURN(Rate)                          !and return it

PassCompute RETURN(999999)             !Return bogus number

See Also:

LOOP

goto_go_to_a_label_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)