| Fortran Language Reference Manual, Volume 1 - S-3692-51 | ||
|---|---|---|
| Prev Section | Chapter 8. Controlling Execution | Next Section |
The arithmetic IF statement is a three-way branching statement based on an arithmetic expression.
The arithmetic IF statement is defined as follows:
The same label can appear more than once in an arithmetic IF statement.
The numeric expression must not be of type complex.
Each statement label must be the label of a branch target statement in the same scoping unit as the arithmetic IF statement itself.
The execution begins with the evaluation of the expression. If the expression is negative, the branch is to the first label; if zero, to the second label; and if positive, to the third label.
The following example shows an arithmetic IF statement:
READ *, DATA
IF(DATA) 10, 20, 30
10 PRINT *, 'NEGATIVE VALUE'
...
20 PRINT *, 'ZERO VALUE'
...
30 PRINT *, 'POSITIVE VALUE'
... |
| Prev Section | Table of Contents | Title Page | Index | Next Section |
| Branching | Up one level | Glossary |