Nofal, Mostafa wrote:
> Hello all,
>
> If I have three variables, A, B, and C.
> After calculating variable(s) C would I be able to write in one line,
> i.e.
> A=B=C;
> Currently, I write
> A = C;
> B = C;
There are occasional suggestions to allow this in Fortran, plus
alternatives that might allow similar capabilities. Nothing like
that is allowed so far.
> Am I out to lunch? or this doable since for example, one can write
> IF ( A==B==C ) THEN
> . . .
> END IF
> Also, all other controls can accept these instructution such as
> DO WHILE ( A==B==C)
> END DO
Neither of those are legal fortran. The expression A==B has
type LOGICAL, and you can't compare a LOGICAL value to anything
with another == operator (not even to another LOGICAL value).
If your compiler accepts the above, you should be very cautious:
it may not be doing what you think it should. I recommend you find
the compiler switch that requires standard conformance and use it.
That way you'll get appropriate error messages when you attempt
dangerous extensions such as this.
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
|