HP Fortran Programmer's Reference (September 2007)

Execution control
Flow control statements
Chapter 6 151
Any END statement
Any IF statement
Syntax
IF (
logical-expression
)
executable-statement
Execution logic
1.
logical-expression
is evaluated.
2. If it evaluates to true,
executable-statement
executes.
3. The normal flow of execution resumes with the first executable statement following the IF
statement. (If
executable-statement
is an unconditional GO TO statement, control
resumes with the statement specified by the GO TO statement.)
Example
LOGICAL :: finished
.
.
.
IF ( finished ) PRINT *, ”Done.”
PAUSE statement
The PAUSE statement causes a temporary break in program execution.
Syntax
PAUSE [
pause-code
]
where
pause-code
is a character constant or a list of up to 5 digits.
Execution logic
1. Execution of the program is suspended, and the following message is written to standard
output:
To resume execution, type 'go'.
If
pause-code
is specified, the following message is written:
To resume execution, type 'go'.
PAUSE
pause-code
2. The normal flow of execution resumes after the user types the word go followed by
RETURN. If the user enters anything other than go, program execution terminates.
If the standard input device is other than a terminal, the message is: