Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran Compiler for HP-UX: HP Fortran Programmer's Reference > Chapter 10 HP Fortran statements

IF (block)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Begins an IF construct.

Syntax

[construct-name :] IF (logical-expression) THEN
construct-name

is the name given to the IF construct. If construct-name is specified, the same name must also appear in the END IF statement.

logical-expression

is a scalar logical expression.

Description

The IF statement executes the immediately following statement block if logical-expression evaluates to true.

The IF construct, which the IF statement begins, may include ELSE IF statements and an ELSE statement to provide alternate statement blocks for execution.

The block following the IF statement may be empty.

As an extension, HP Fortran allows the transfer of control into an IF construct from outside the construct.

Examples

IF (x <= 0.0 .AND. y > 1.0) THEN
CALL fix_coord(x, y)
END IF

Related statements

ELSE, ELSE IF, IF (arithmetic), IF (logical), and END (construct)

Related concepts

For information about the IF construct, see IF construct”.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.