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

ELSE

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Provides a default path of execution for IF construct.

Syntax

ELSE [ construct-name ]
construct-name

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

Description

The ELSE statement is used in an IF construct to provide a statement block for execution if none of the logical expressions in the IF and ELSE IF statements in the IF construct evaluates to true.

An IF construct may contain (at most) one ELSE statement. If present, it must follow all ELSE IF statements within the IF construct.

Examples

IF (a > b) THEN
max = a
ELSE IF (b > max) THEN
max = b
ELSE
PRINT *, 'The two numbers are equal.'
STOP 'Done'
END IF

Related statements

ELSE IF, END IF, and IF (construct)

Related concepts

See IF construct”.

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