Because the code to be executed is evaluated at run-time and not compiled, yes – cfif/cfelse is (almost) always faster than IIf().  The only time this wouldn’t be true is if you had the following statement:

 

<cfif somethingIsTrue>

            <cfset result = Evaluate(“something”)>

<cfelse>

<cfset result = Evaluate(“somethingElse”)>

</cfif>

 

That statement is functionally equivalent to IIf(somethingIsTrue, “something”, “somethingElse”).

 

Roland

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Knudsen
Sent: Thursday, May 26, 2005 5:49 PM
To: [email protected]
Subject: Re: [CFCDev] CFC wish-list

 

 

On 5/26/05, Sean Corfield <[EMAIL PROTECTED]> wrote:

On 5/26/05, Adam Cameron <[EMAIL PROTECTED]> wrote:
> Oh, well I guess their idea is - as the docs actually say, now that I
> look at them - that the second and third arguments are just STRINGS.
> And then iif() kindly does an implicit evaluate() on those strings for
> you (yeech: what a nightmare).

And you wonder why the Web Team Coding Guidelines say:

"Don't use iif()

Always use cfif/cfelse instead of iif(). It is significantly faster
and more readable."

 

 

 

is this still so under cfmx?  the faster part that is.

 

DK

 

:) :)
--
Sean A Corfield -- http://corfield.org/
Team Fusebox -- http://fusebox.org/
Got Gmail? -- I have 50, yes 50, invites to give away!

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]




--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it? ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to