noob question about boolean methods

A

Arne Vajhøj

In said:
Reminds me of working in FORTRAN 66, I wanted to see if two Boolean variables were equal or not. It turned out the compiler wouldn't let me use the .EQ. test on Boolean:

LOGICAL P, Q
...
...
...
IF ( P .EQ. Q) <imperative statement>

generated a compiler error.

At least in Fortran 77 you could use .EQV. to compare logicals - I am
not quite sure whether that was available in Fortran 66.
I used an exclusive or:

IF ( .NOT. (P .XOR. Q)) <imperative statement>

That expresses the intent pretty well, so ...

(I would even say that XOR and NOT are more natural operators
for LOGICAL than EQV)

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,249
Latest member
KattieCort

Latest Threads

Top