IDL recognizes 0 as logical false and 1 as logical true. The situation is similar to original C, where, if I remember correctly, there also was no (and perhaps still is no) "bool" datatype. In this case, it made sense for programs to have statements like:
#define TRUE 1
#define FALSE 0
Same concept in IDL, where you could possibly set a definition like the above in an IDL COMMON block (see Online Help for "COMMON statement"). Alternatively, just have the expressions:
TRUE = 1
FALSE = 0
at the beginning of your PRO or FUNCTION, then use syntax like:
if result eq TRUE then ...
The only reason to take this approach, however, is because you think it makes your code more easily READABLE.
James Jones
|