XL Fortran for AIX 8.1

Language Reference

IF (Logical)

Purpose

The logical IF statement evaluates a logical expression and, if true, executes a specified statement.

Format



>>-IF--(--logical_expr--)--stmt--------------------------------><
 
 

logical_expr
is a scalar logical expression

stmt
is an unlabeled executable statement

Rules

When a logical IF statement is executed, the logical_expr is evaluated. If the value of logical_expr is true, stmt is executed. If the value of logical_expr is false, stmt does not execute and the IF statement has no effect (like a CONTINUE statement).

Execution of a function reference in logical_expr can change the values of variables that appear in stmt.

stmt cannot be a SELECT CASE, CASE, END SELECT, DO, DO WHILE, END DO, block IF, ELSE IF, ELSE, END IF, END FORALL, another logical IF, ELSEWHERE, END WHERE, END, END FUNCTION, END SUBROUTINE statement, FORALL construct statement or WHERE construct statement.

Examples

      IF (ERR.NE.0) CALL ERROR(ERR)

Related Information

Chapter 6, Control


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