STATEMENT | Description | Example of Usage |
---|---|---|
Arithmetic IF | Transfers control, depending on whether value of an arithmetic expression is negative, zero, or positive | IF (X-Y) 30, 40 , 50 |
ASSIGN | Assigns a statement number to a variable | ASSIGN 50 TO N |
Assigned GO TO | Transfers control to a statement specified by a variable; in conjunction with ASSIGN statement | GO TO N |
Assignment | Assigns a value to a variable | PI = 3.1416 NUMBER = 0 MAJOR = ' CPSC ' Z FLAG = . TRUE . |
BACKSPACE | Backspace a file | BACKSPACE 12 |
BLOCK DATA | Heading of a block data subprogram used to initialize variables in named common blocks | INTEGER MONTH, YEAR COMMON / INFO / MONTH, YEAR DATA MONTH, YEAR /12, 1995/ END |
BLOCK IF | Executes or bypasses a block of statements, depending on truth or falsity of a logical expression; must be paired with END IF and may have ELSE or ELSE IF blocks | IF (X.GT. O) THEN RESULT = SQRT(X) ELSE IF (X .EQ. 0) THEN PRINT *, 'NUMBER IS 0' ELSE PRINT *, 'NEGATIVE NUMBER' END IF |
CALL | Calls a subroutine | CALL CONVER (A, T, X, Y) |
CHARACTER | Specifies character type | CHARACTER*10 NAME, INIT*1, LIST(20) |
CLOSE | Closes a file | CLOSE (12) |
COMMON | Establishes blank or named common areas | COMMON ALPHA, BETA, MAT (5,5) COMMON / INFO / MONTH, YEAR |
COMPLEX | Specifies complex type | COMPLEX Z, W, MAT (5,5) |
Computed GO TO | Transfers control to one of several statements, depending on the value of an integer expression | GO TO (10, 20, 30, 40) CLASS |
CONTINUE | Used to close a DO-loop | 5 CONTINUE |
DATA | Initializes variables at compile time | DATA PI, (X(I),I=1,5) /3.14,5*0/ |
DIMENSION | Declares dimensions of arrays | DIMENSION MAT(5,5), LIST(20) |
DO | First statement of a DO-loop | DO 5 I=1, N |
DOUBLE PRECISION | Specifies double precision type | DOUBLE PRECISION A, B, ROOTS(20) |
ELSE | Defines ELSE-block in a block IF statement | See block IF statement |
ELSE IF | Defines ELSE-IF block within a block IF used for multialternative selection | See block IF statement |
END | Last statement of each program unit | END |
END IF | Last statement of a block IF | See block IF statement |
ENDFILE | Places end-of-file record in a file | ENDFILE 12 |
END WHILE, END DO | Terminates a WHILE loop; not in standard FORTRAN 77 | See WHILE statement |
ENTRY | Specifies entry point in a subprogram | ENTRY POLY (X) |
EQUIVALENCE | Establishes sharing of memory locations by different variables in same program unit | EQUIVALENCE(X,Y), (ALPHA,A,T(3)) |
EXTERNAL | Specifies externally defined subprograms that may be used as arguments | EXTERNAL F, QUAD |
FORMAT | Defines a list of descriptors | 20 FORMAT (1X, 'ROOTS ARE', 2F8.3) |
FUNCTION | Heading for a function subprogram | FUNCTION AVE(X, N) |
GO TO | Unconditionally transfers control to a specified statement | GO TO 100 |
IMPLICIT | Used to establish a naming convention | IMPLICIT REAL (L,N-Z), INTEGER (A-K) |
INQUIRE | Determines properties of a file or of its connection to a unit number | INQUIRE (EXIST = FLAG, NAME =FNAME) |
INTEGER | Specifies integer type | INTEGER X, CLASS, TABLE(10,20) |
INTRINSIC | Specifies intrinsic functions that may be used as arguments | INTRINSIC SIN, DSQRT |
LOGICAL | Specifies logical type | LOGICAL P, Q, TABLE(4,6) |
Logical IF | Executes or bypasses a statement depending on the truth or falsity of a logical expression | IF (DISC .GT. 0) DISC = SQRT(DISC) |
OPEN | Opens a file | OPEN(UNIT = 12, FILE = FNAME, STATUS = 'OLD') |
PARAMETER | Defines parameters | PARAMETER (LIM = 100, RATE =1.5 |
PAUSE | Interrupts program execution, program may be restarted | PAUSE PAUSE 'PROGRAM PAUSE' |
Output statement | PRINT *, 'X = ', X PRINT * PRINT '(1X, 317)', M, N, M + N-e |
|
PROGRAM | Program heading | PROGRAM WAGES |
READ | Input statement | READ *, ALPHA, BETA READ '(15, F7.2)', NUM, Z READ (12, *, END = 20) HOURS, RATE |
REAL | Specifies real type | REAL NUM, GAMMA, MAT(10,10) |
RETURN | Returns control from subprogram to calling program unit | RETURN RETURN 2 |
REWIND | Positions file at initial point | REWIND 12 |
SAVE | Saves values of local variables in a subprogram for later references | SAVE X, Y, NUM SAVE |
Statement function | Function defined within a program unit by a single statement | F(X,Y) = X**2 + Y**2 |
STOP | Terminates execution | STOP STOP 'PROGRAM HALTS' |
SUBROUTINE | Heading for subroutine subprogram | SUBROUTINE CONVER (U, V, RHO, PHI) |
WRITE | Output statement | WRITE (*,*) A, B, C WRITE (12,'(1X, 316)') N1, N2, N3 |