FORTRAN 77 Language Reference

Examples

Example 1: A variable and array as parameters:


       SUBROUTINE SHR ( A, B ) 
       CHARACTER A*8 
       REAL B(10,10) 
       ...
       RETURN 
       END 

Example 2: Standard alternate returns:


       PROGRAM TESTALT 
       CALL RANK ( N, *8, *9 ) 
       WRITE (*,*) 'OK - Normal Return [n=0]' 
       STOP 
8     WRITE (*,*) 'Minor - 1st alternate return [n=1]' 
       STOP 
9     WRITE (*,*) 'Major - 2nd alternate return [n=2]' 
       END 
       SUBROUTINE RANK ( N, *, * ) 
       IF ( N .EQ. 0 ) RETURN 
       IF ( N .EQ. 1 ) RETURN 1
       RETURN 2 
       END

In this example, the RETURN 1 statement refers to the first alternate return label (first *). The RETURN 2 statement refers to the second alternate return label (second *) specified in the SUBROUTINE statement.