Home »
Public Forums »
archive »
evaluation of logical expressions
evaluation of logical expressions [message #5083] |
Thu, 21 September 1995 00:00 |
Russ Welti
Messages: 27 Registered: October 1994
|
Junior Member |
|
|
I've often wondered the reason why the following:
IDL> a=0
IDL> if a and b then print,'yes'
% Variable is undefined: B.
% Execution halted at: $MAIN$
Many languages stop evaluating logical expressions as soon
as the result can be determined. I'm sure there's a good
reason why IDL doesn't, but it means that in my code I
use a lot of these:
if n_elements(a) GT 0 then $
if a EQ 5 then $
where I *would* have liked to say:
if n_elements(a) GT 0 and a EQ 5 then $
Anybody know any background on this?
/
Russ Welti /-\
rwelti@u.washington.edu \-/
|
|
|
Current Time: Wed Oct 08 17:23:31 PDT 2025
Total time taken to generate the page: 0.00489 seconds