> In ColdFusion, doing a boolean evaluation on a non-zero value will return
> true. It's been that way for a long time. So, in your original e-mail, you
> were mistaken when you thought that CF was multiplying 1*3. In reality, it
> was just saying "TRUE is true" and "3 is true" (again, because 3 is a
> non-zero value). This is why you can use the following code:
>
> <cfif myQuery.recordCount>
> <!--- This will run if there is at least one record --->
> </cfif>
>
Yes, I understand that. That's why I would have expected
<cfoutput>#(TRUE AND 3)#</cfoutput> to return "TRUE" (or, more likely,
"Yes").
The question was why it was returning "3". As Barney pointed out, it
was actually returning whatever the last evaluated _expression_ was (which
still seems pretty stupid).
Of course, why would you ever even do something like <cfoutput>#(TRUE
AND 3)#</cfoutput>? It's a pretty lame bit of code which thankfully
didn't come up on the certification test today. (Of course, by that
point, I would have gotten it right anyway).
Scott
--
---------------------------
Scott Brady
http://www.scottbrady.net/
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

