Intel fortran-80 Laptop User Manual


 
Program Execution Controls
4-2
Examples:
GO TO (1010,1020,1030) K
C IF K =
2,
FOR EXAMPLE, CONTROL PASSES TO STATEMENT
C 1020
INTEGER*1 SWITCH
SWITCH
= K/J
GO TO
(10,500,500,10,10)
SWITCH
C NOTE
THAT
'J' MUST BE .LE.
'K'
IN THIS EXAMPLE
GO TO
(10,
500, 600, 500) K * L + 1
4.1.3 Assigned GO TO Statement
The assigned
GO
TO
statement
is
used with the ASSIGN statement. The assigned
GO
TO
is
similar
to
the
computed
GO
TO,
but in this case the control
is
an integer
variable name. Before the assigned
GO
TO
is
executed, the variable name must be
defined with the value
of
a statement label by an ASSIGN statement in the same pro-
gram
unit.
The
format
of
the assigned
GO
TO
statement
is
GO TO name
n,]
(stl
[,stl]
...
)]
where
name
stl
is
an
integer variable name
is
the statement label
of
an
executable statement
III
the same
program
unit as the assigned
GO
TO.
The
same statement label may
appear
more
than
once in the statement.
If
the paren-.
thesized list
of
statement labels
is
present, the statement label assigned
to
'name'
must be one
of
the labels in the list.
Examples:
ASSIGN
10TO
START
GOTOSTART
ASSIGN 999 TO DONE
GO TO DON
E (500, 600, 999)
4.1.4 Arithmetic I F Statement
The
arithmetic IF statement behaves similarly
to
a computed
GO
TO.
Control
is
transferred
to
one
of
three possible statements based on the value
of
a controlling
expression. The
format
of
the arithmetic IF
is
IF(exp)s1,s2,s3
where
exp
is
an
integer
or
real expression
s
is
the statement label
of
an
executable statement in the same
program
unit as the arithmetic IF.
The
same statement label may
appear
more
than
once in the statement.
If
the value
of
'exp'
is
less
than
zero, control passes to the first statement listed;
if
it
equals zero, control passes
to
the second statement;
if
'exp'
is
greater
than
zero, con-
trol passes to the third statement.
FORTRAN-SO