Sean Corfield
Fri, 03 Dec 2004 18:14:55 -0800
On Fri, 03 Dec 2004 18:08:30 +1100, Geoff Bowers <[EMAIL PROTECTED]> wrote: > Sean Corfield wrote: > > Nope, you can't do that. iif() always evaluates all three arguments > > (and iif() is evil anyway - it is not the way to write clear code). > Bah.. I hear this drivel all the time.
Note that my first statement is *not* 'drivel':
<cfif isDefined("myVar")>
<cfset result = "the value myVar is " & myVar>
<cfelse>
<cfset result = "">
<cfif>
The above works. The following, with iif(), does not:
<cfset result = iif(isDefined("myVar"),"the value myVar is " & myVar,"")>
iif() will evaluate all three arguments first, *then* return either
the 2nd or 3rd argument based on the value of the 1st argument.
--
Sean A Corfield -- http://www.corfield.org/
Team Fusebox -- http://www.fusebox.org/
Breeze Me! -- http://www.corfield.org/breezeme
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
---
You are currently subscribed to cfaussie as: archive@mail-archive.com
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/