forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GOTO (Assigned GOTO)
                                             Up Contents Index Back
─────GOTO (Assigned GOTO) ──────────────────────────────────────────────────
 
     Action
 
     Transfers execution to the statement label assigned to <variable>.
 
     Syntax
 
     GOTO variable [ [,] (labels)]
 
     Parameter          Description
 
     variable           An integer variable. The <variable> must have
                        been assigned the label of an executable
                        statement in the same program unit.
 
     labels             A list of one or more labels of executable
                        statements in the same program unit. Separate
                        multiple labels with commas.
 
                        A <label> may appear more than once in a list.
 
     Remarks
 
     GOTO statements may not transfer control into a DO, IF, ELSEIF,
     or ELSE block from outside the block. The $DO66 metacommand can
     override this restriction for DO loops.
 
     See Also: $DO66
 
     Examples
 
           ASSIGN 10 TO n
           GOTO n
        10 CONTINUE
 
     The following example uses an assigned GOTO statement to check the
     value of clearance:
 
     $DEBUG
 
           INTEGER  view, clearance
     C     Assign an appropriate label to view:
           IF (clearance .EQ. 1) THEN
              ASSIGN 200 TO view
           ELSE IF (clearance .EQ. 2) THEN
              ASSIGN 400 TO view
           ELSE
              ASSIGN 100 TO view
           END IF
 
     C     Show user appropriate view of data depending on
     C     security clearance.
           GOTO view (100, 200, 400)
 
     C     If view had not been assigned one of the valid labels
     C     (100, 200, or 400), a run-time error would have occurred.
 
       100 CONTINUE
           .
           .
           .
       200  CONTINUE
           .
           .
           .
       400  CONTINUE
           .
           .
           .
           END
                                    -♦-