IIF() is shorthand replacement for IF/THEN/ELSE. Other langs have
IIF() too, eh?
Thus
<cfif foo IS 5>
foo is 5
<cfelse>
foo is not 5
</cfif>
is equivalent to
IIF(foo IS 5, "'foo is 5'", "'foo is not 5'")
*note...mind the quotes! "' is double quote followed by single quote
DK
On 5/1/06, Matthew Chambers <[EMAIL PROTECTED]> wrote:
> 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:239217
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