GOTO

GOTO

Top  Previous  Next

 

The GOTO statement continues program execution at a given label.

 

 

Format

 

GOTO label{:}

GO {TO} label{:}

 

where

 

labelis the label attached to the statement at which execution is to continue.

 

 

The trailing colon is optional and has no effect on the action of the statement.

 

The program continues execution at the given label. The label may be any label defined within the program or subroutine. Excessive use of GOTO and labels in place of other language constructs (e.g. LOOP/REPEAT) can make programs difficult to maintain.

 

 

Example

 

IF REC[1,1] # "A" THEN GOTO ERROR

 

This program fragment checks if the first character of REC is "A". If not, it jumps to label ERROR.