FORTRAN Reference Manual
Statements
FORTRAN Reference Manual—528615-001
7-62
IF Statement—Block
•
You can ensure that your program executes at least one if-block by using ELSE 
IF and ELSE statements:
IF(loan type .EQ. 'A') THEN
rate = normal rate
premium = 1000
ELSE IF (loan type .EQ. 'B') THEN
rate = normal rate * .9
premium = 500
ELSE IF (loan type .EQ. 'C') THEN
rate = normal rate * .85
premium = 100
ELSE
rate = normal rate * .75
premium = 50
END IF
•
You can code an empty if-block if you want to test for a specific value but not 
take action for that value. In the following example, if LOAN TYPE equals “A”, no 
statements are executed and control passes immediately to the statement 
following the END IF statement:
IF(loan type .EQ. 'A') THEN
ELSE
rate = normal rate * .75
premium = 50
END IF
•
Do not transfer control into an IF block from outside the IF block.
•
You can nest block IF statements. Terminate each block IF statement with an END 
IF statement. The first IF statement is paired with the last END IF statement, the 
following IF statement is paired with the next to last END IF statement, and so 
forth. The nesting scheme is similar to the nested DO loop structure. The following 
example shows a nested IF block structure.










