It used to be, but is not so anymore, that IIF() was slower than <cfif><cfelse></cfif>.
It also used to be true, although I don't think it is any more, that all of the expressions in an IIF() are evaluated even if not used. Not true of <cfif>. I know in older versions this would cause an error: #iif(isDefined("myVar"),"myVar","'undefined'"))# However, this wouldn't: <cfif isDefined("myVar")> #myVar# <cfelse> undefined </cfif> Yeah, I thought it was pretty goofy too. I only ever really use iif() in situations like this: <select name="chosenOption"> <cfloop query="qOptions"> <option value="#qOptions.option_id#" #iif(qOptions.option_id eq variables.default_option_id,"'selected'","''")#>#qOptions.option_name#</ option> </cfloop> </select> I think it's very bad style to put CF tags inside HTML tags. -----Original Message----- From: Matthew Chambers [mailto:[EMAIL PROTECTED] Sent: Monday, May 01, 2006 7:40 PM To: CF-Talk Subject: The IIf function Hi all, Am I correct in saying that the IIf function and the <cfif> tag work differently on the following scenerio. In the CFIF tag, when the CFIF fails it will "jump over" the code which follows until a CFELSEIF, CFELSE or CFIF. Here's an example: ---------- <CFIF> The cfif failed so this text is not run. More to the point this code is not run, <cfquery>KILL DATABASE</cfquery> </CFIF> ----------- Where as with the IIf function, CF will still test that the code for both the true and false cases will work? This is dumb, because the whole point for an IF is to check that you will have everything you need to run the code when it returns true. :::CFIF eg::: <cfif IsDefined("foo"> <cfset foo = foo+1> </cfif> :::IIf eg::: Iif(IsDefined("foo"),DE(foo=foo+1),DE('whatever')) Any thoughts? Cheers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239234 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54