FORTRAN 77 Language Reference

Examples

Example 1: Arithmetic statement function:


       PARAMETER ( PI=3.14159 ) 
       REAL RADIUS, VOLUME 
       SPHERE ( R ) = 4.0 * PI * (R**3) / 3.0 
       READ *, RADIUS 
       VOLUME = SPHERE( RADIUS ) 
       ... 

Example 2: Logical statement function:


       LOGICAL OKFILE 
       INTEGER STATUS 
       OKFILE ( I ) = I .LT. 1 
       READ( *, *, IOSTAT=STATUS ) X, Y 
       IF ( OK FILE(STATUS) ) CALL CALC ( X, Y, A ) 
       ... 

Example 3: Character statement function:


       CHARACTER FIRST*1, STR*16, S*1
       FIRST(S) = S(1:1) 
       READ( *, * ) STR 
       IF ( FIRST(STR) .LT. " " ) CALL CONTROL ( S, A ) 
       ...