Re: printing logical variables as "true" and "false"



Nestor Grion wrote:
Hello
In Matlab:

     F => 0
     T => 1

     0 => F
     else => T

Slightly off topic, but in IDL:

  F => Zero and even values (e.g. -4, -2, 0, 2, 4, etc)
  T => Odd non zero values (e.g. -3, -1, 1, 3, 5, etc)

(which I can't stand, btw.)

I much prefer the Fortran logicals .true. and .false. It's quite clear what it means. 0 and 1 have different meanings in different contexts/languages, e.g. "exit 0" from a Bourne shell script is a good result, whereas "exit 1" (or some other integer) flags an error. By the logic where F=>0 and T=>1, I would think that "exit 0" == "exit false" and it indicates an error. With Fortran I don't have to worry about that.

cheers,

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
.


Quantcast