next up previous contents
Next: Computer Representation of Numbers Up: Exceptional Situations Previous: RETURN   Contents

GO TO

Syntax:

or

A statement label ( ) is a number of up to 5 digits (), written in column 1 through 5 (this is inherited from the fixed form). It is separated from the statement it labels by at least 1 blank.

For example,

12345 PRINT*, "Error"
001   CONTINUE

The statement immediately transfers control to the statement labeled by .

IF (A .EQ. 0) GO TO 12345
........
12345 PRINT*, "Error: A=0"
! Begin the recover-from-error strategy

The can be an integer expression, evaluated at run time.

Except when needed to recover from error situations, we will avoid the use of GO TO, since it leads to unstructured programs.

``Experience over many years has shown [GOTO statements] to be the single biggest cause of bad programming habits and consequent programming errors.'' (T. Ellis, I. Philips, T. Lahey).



Adrian Sandu 2001-08-26