If you are on CF9 you could do something like

i = 1;
tmp = i == 1 ? "#i#" : "";

In this case, the expression is processed immediately.



On Thu, Sep 16, 2010 at 3:25 PM, Terry Sasaki <[email protected]> wrote:
> yeah I kinda agree. DE("[a]") needs to be used eventually.
>
> On 16 September 2010 15:06, Chris Velevitch <[email protected]> wrote:
>> In CF 7, the function IIF (inline IF) usage is:-
>>
>>     IIf(condition, string_expression1, string_expression2)
>>
>> which I initially interpreted to be the equivalent of:-
>>
>>     <cfif condition>
>>          <cfset result = string_expression1>
>>     <cfelse>
>>          <cfset result = string_expression2>
>>     </cfif>
>>
>> but when I do:-
>>
>>     #IIF(condition,"[a]","")#
>>
>> I get an error.
>>
>> On closer inspection, it turns out that IIF is really the equivalent of:-
>>
>>     <cfif condition>
>>          <cfset result = Evaluate(string_expression1)>
>>     <cfelse>
>>          <cfset result = Evaluate(string_expression2)>
>>     </cfif>
>>
>> I've been interpreting 'string_expression' to mean an expression that
>> returns a string, but really means a string (or string variable) that
>> contains an expression.
>>
>> Why is this? How do I do in-line case/switch expression?
>>
>>
>> Chris
>> --
>> Chris Velevitch
>> Manager - Adobe Platform Users Group, Sydney
>> m: 0415 469 095
>> www.apugs.org.au
>>
>> Adobe Platform Users Group, Sydney
>> September 2010:  The "State of CFML" Address
>> Date: 27th September, 6pm for 6:30 start
>> Details and RSVP coming.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "cfaussie" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/cfaussie?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "cfaussie" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/cfaussie?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to