Statement 
Description 
Examples 



Assignment 
assigns a value to a variable 
pi = 3.1415 
statement 

text = 'abcedf' 
Block IF 
Branching conditional construct 
IF (x > 0.) THEN 
construct 

result = SQRT(x) 


ELSE IF (x==0.) THEN 


result = 0. 


ELSE 


result = SQRT(x) 


END IF 
CALL 
Calls a subroutine 
CALL numerical_sort(data) 
CASE 
Branching among mutually 
SELECT CASE (j) 

exclusive choices 
CASE (1,2,5) 


block 1 commands 


CASE (3:0) 


block 2 commands 


CASE DEFAULT 


block 3 commands 


END SELECT 
CHARACTER 
Declares variables or named 
CHARACTER(len=10) :: string 

constants of character type 

CLOSE 
Closes a file 
CLOSE(10) 
COMPLEX 
Declares variables or named constants 
COMPLEX xypair 

of complex type 
COMPLEX, DIMENSION(10) :: carray 
CYCLE 
Branches to top of loop 
CYCLE 
DO (counting 
A loop that repeats a block of 
DO j = 1, 10, 2 
loop) construct 
statements a specified number of times 
write(*,*) ``Root is '', SQRT(j) 


END DO 
DO (while 
A loop that repeats a block of 
DO 
loop) construct 
statements until a condition is met 
IF (j==1) EXIT 


... 


END DO 
END FUNCTION 
Last statement of a function 
END FUNCTION myfunc 
END MODULE 
Last statement of a module 
END MODULE mymod 
END PROGRAM 
Last statement of a program 
END FUNCTION myprog 
END SUBROUTINE 
Last statement of a subroutine 
END SUBROUTINE mysub 
EXIT 
Branches out of a loop to the 
IF (val < 0.) EXIT 

first statement after the loop 

FORMAT 
Defines the format for 
12 FORMAT('Int = ', I4) 

input or output of data 
WRITE(*,12) counter 
FUNCTION 
Declares the beginning of a 
INTEGER FUNCTION factorial(n) 

userdefined function subprogram 

IF 
Executes or skips the associated 
IF (y < 0.) y = SQRT(y) 

statement depending on the 


conditional. 

IMPLICIT NONE 
Forces explicit typing 
IMPLICIT NONE 
INTEGER 
Declares variables or named 
INTEGER :: i, j, k 

constants of integer type 
INTEGER, DIMENSION(25) :: i 
LOGICAL 
Declares variables or named 
LOGICAL test1 

constants of logical type 
LOGICAL, DIMENSION(25) :: flag 
OPEN 
Opens a file 
OPEN(10) 
PROGRAM 
Defines a program and its name 
PROGRAM my_prog 
READ 
Reads in data 
READ(*,*) key_input 


READ(myfile,'(I5)') 


READ (12, 50) a(1), a(2) 
REAL 
Declares variables or named 
REAL fvalue 

constants of floatingpoint type 
REAL, DIMENSION(3,3) :: avecs 
RETURN 
Returns control from a procedure 
RETURN 

to the routine that invoked the 


procedure 

STOP 
Stops execution of the program 
STOP 
SUBROUTINE 
Declares the beginning of a 
SUBROUTINE inverse(matrix) 

userdefined subroutine 

WHERE 
Masked array assignment 
WHERE (x > 0.) 


x = SQRT(x) 


END WHERE 
WRITE 
Writes data 
WRITE(*,*) screen_out 


WRITE(myfile,'(6F8.3)') vector(1:6) 


WRITE (12, 50) a(1:3) 


