Intel fortran-80 Laptop User Manual


 
CHAPTER 4
PROGRAM
EXECUTION CONTROLS
FORTRAN
includes
16
statements,
or
statement variations, for controlling
program
execution. These are statements
that
transfer control (GO
TO,
IF,
and
their varia-
tions), regulate execution loops
(DO,
CONTINUE),
and
terminate
program
execu-
tion
(PAUSE,
STOP,
END).
4.1
Transferring Program Oontrol
The
statements in this
group
pass
control
to
another
part
of
the
program,
in some
cases only when a stated condition
is
meL
These alternatives are usually referred
to
as conditional
and
unconditional branching. Some statements also allow
an
alter-
native set
of
operations
to
be
performed
if.the stated conditions are not met.
The
statements
that
transfer
program
control are:
Unconditional
GO
TO
Computed
GO
TO
Assigned
GO
TO
Arithmetic
IF
Logical
IF
4.1.1
Unconditional GO
TO
Statement
Block
IF
ELSE
IF
ELSE
END
IF
The
unconditional
GO
TO
statement transfers control
to
the next statement
to
be ex-
ecuted.
It
has the
format
GO TO
stl
where
'stl'
is
the statement label
of
an
executable statement in the same
program
unit
as the
GO
TO
statement.
Example:
GO TO 1010
4.1.2 Computed GO TO Statement
The
computed
GO
TO
statement branches
to
one
of
several executable statements
based on the value
of
a controlling integer expression. The
format
of
the
computed
GOTO
is
GO TO
(stl
[,stl] ... )[,]exp
where
exp
is
an
integer expression
stl
is
the statement label
of
an
executable statement in the same
program
unit as the
computed
GO
TO.
The same statement label may
appear
more
than
once in the statement.
If
the integer
expression has a value in the range
1::5
exp::5
n (where
'n'
is
the
number
of
statement
labels in the list), control passes to the statement pointed
to
by
'exp.'
If
'exp'
is
out-
side this range, execution continues with the statement following the
GO
TO.
4-1