Intel fortran-80 manual Block IF Statement, 4.1.8ELSE IF Statement

Models: fortran-80

1 130
Download 130 pages 742 b
Page 44
Image 44
4.1.7 Block IF Statement

Program Execution Controls

FORTRAN-SO

An ELSE block consists of all the executable statements after the ELSE statement up to, but not including, the next END IF statement that has the same nesting level as the ELSE statement.

For each block IF statement, there must be a corresponding END IF statement in the same program unit.

IF ...

 

 

 

 

 

 

 

 

IIF BLOCK

 

 

 

ELSE IF ...

 

 

 

 

 

IF ...

=:J

ELSE IF BLOCK

:

 

IF BLOCK

END IF

 

 

 

 

 

ELSE _______________-- ,

IF ...

 

 

 

 

 

 

 

 

 

 

 

 

IF. . . ] IF BLOCK

 

IF BLOCK

ELSE BLOCK

 

 

 

 

 

 

 

ENDIF

 

 

 

END IF _________

 

 

 

 

 

END IF _______________

 

4.1.7 Block IF Statement

The format of the block IF is

IF (exp) THEN

where 'exp' is a logical expression.

If the value of 'exp' is TRUE, execution continues with the first statement of the IF block. If the IF happens to be empty and 'exp' is TRUE, control passes to the next END IF statement on the. same nesting level as the block IF statement. If 'exp' is FALSE, control passes to the next ELSE IF, ELSE, or END IF on the same nesting level as the block IF statement.

Control cannot be transferred into an IF block from outside the IF block (but see section F.2.9.3).

If the last statement in the IF block does not transfer control to another executable statement, control passes to the next END IF statement that has the same nesting level as the block IF statement.

An example if shown following the description of the END IF statement.

4.1.8ELSE IF Statement

The ELSE IF statement has the format

ELSE IF (exp) THEN

where 'exp' is a logical expression.

4-4

Page 44
Image 44
Intel fortran-80 manual Block IF Statement, 4.1.8ELSE IF Statement