A SERVICE OF

logo

FORTRAN Concepts
2-10
The
following example passes
control
to
line
10
if
the logical variable
DONE
is
not
true. Otherwise, execution stops.
10
FLAG
=
FLAG
+ 1
DONE
=
(FLAG
.GT.
99)
IF
(.NOT.
DONE)
THEN
GOTO
10
ELSE
STOP
ENDIF
The
value when two logical
operands
are
combined
by
.AND.
is
as follows:
OP1
OP2
OP1
.AND. OP2
TRUE TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
If
both
operands
are
true, the logical expression
is
true.
This example achieves the same effect as the last example.
IF
(FLAG
.GT.
0
.AND.
FLAG
.LE.
99)
GO
TO
10
STOP
The
value when two logical
operands
are
combined
by . OR.
is
as follows:
OP1
OP2
OP1.0R.OP2
TRUE
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
If
either
operand
is
true,
the logical expression
is
true.
The
following
statement
branches
on
either
of
two conditions.
IF
(FLAG
.EO.
50
.OR.
FLAG
.LE.
10)
GO
TO
250
The
value when two logical
operands
are
combined
by .EQV.
is
as follows:
OP1
OP2
OP1
.EQV. OP2
TRUE TRUE TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
If
both
operands
are
logically the same, the logical expression
is
true.
FORTRAN-SO