Re: Evaluation of IF-Statements

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 17 Aug 2007 09:30:01 -0600

NCL guarantees left-to-right evaluation.
"lazy expression evaluation' is used.

   if ( a .and. b .and. c .....) then
         ....
   end if
If "a" is False ... no further expressions will be evaluated
and the 1st statement after the "end if" will be executed

if "a" is True, "b" will be evaluated. If "b" is True
then "c" will be evaluated; If "b" is False then the 1st
statement after the "en if" will be executed. etc

Punch line ... put the most likely to fail 1st.

D

Lunde, Bruce N CIV NAVOCEANO, NP1 wrote:
> Hello,
>
> * Are both parts of "if( a .and. b )then" tested if "a" is False ??
> * Are both parts of "if( a .or. b )then" tested if "a" is True ??

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 17 2007 - 09:30:01 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 20 2007 - 09:30:37 MDT