XL Fortran for AIX 8.1

Language Reference

IF (Arithmetic)

Purpose

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

Format



>>-IF--(--arith_expr--)--stmt_label1--,--stmt_label2--,--------->
 
>--stmt_label3-------------------------------------------------><
 
 

arith_expr
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.

Rules

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.

Examples

      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.'
40    CONTINUE

Related Information


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