Cold fusion uses Lazy evaluation.

I use the exact syntax you posted regularly in CF 4.5.1.

Russel

============================================================
  Russel Madere, Jr.         Senior Web Developer
  ICQ: 5446158               http://www.TurboSquid.com

Some days you eat the bear; some days the bear eats you.
============================================================


> -----Original Message-----
> From: Ruslan Sivak [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 17, 2001 09:12
> To: CF-Talk
> Subject: Short Circuit Evaluation
>
>
> I have had to write this kind of code over and over, and was wondering if
> there is a better way like in c++, where it does lazy evaluation.
>
> This is what I want:
>
> <CFIF isDefined("somevar") AND somevar IS "something">
>     do something
> </CFIF>
>
> Of course this fails, since if the variable is not defined, CF stil checks
> the second condition.  In languages like C++, it did lazy
> evaluation, so if
> the first condition was false, it didn't bother checking the second
> condition.  This let people write things like
>
> open(FILE,"file") || die "Can't open file";
>
> So in CF I have to rewrite my above IF statement as 2 statements
>
> <CFIF isDefined("somevar")>
>       <CFIF somevar IS "something">
>            do something
>       </CFIF>
> </CFIF>
>
> Is there a better way?
>
> Ruslan Sivak
> Technologist
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to