XL Fortran for AIX 8.1

Language Reference

IF (Arithmetic)


The arithmetic IF statement transfers program control to one of three executable statements, depending on the evaluation of an arithmetic expression.



is a scalar arithmetic expression of type integer or real

stmt_label1, stmt_label2,  and  stmt_label3
are statement labels of executable statements within the same scoping unit as the IF statement. The same statement label can appear more than once among the three statement labels.


The arithmetic IF statement evaluates arith_expr and transfers control to the statement identified by stmt_label1, stmt_label2, or stmt_label3, depending on whether the value of arith_expr is less than zero, zero, or greater than zero, respectively.


      IF (K-100) 10,20,30
10    PRINT *,'K is less than 100.'
      GO TO 40
20    PRINT *,'K equals 100.'
      GO TO 40
30    PRINT *,'K is greater than 100.'

Related Information

[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]