On Fri, 2004-02-13 at 11:24, Nando wrote:
> I just tripped over something a little strange ...
>
> <cfset bitPublish = 255>
>
> With EQ<br>
> <cfif bitPublish EQ true>
This would seem to be saying "is a (byte, short, int, float) equal to a
boolean" which it is not. cf's "true" on the other had could be some
kind of other datatype too - d'know. But this makes sense as float !=
boolean as boat != truck
> true
> <cfelse>
> false
> </cfif>
>
> <br><br>
>
> Without EQ<br>
> <cfif bitPublish>
This seems to evaluate like C where 0 = false and > 0 = true - so this
makes sense too from that perspective.
Pretty interesting that they are not the same process though - good find
> true
> <cfelse>
> false
> </cfif>
As Barney pointed out, its generally a good idea to test datatypes
against the same datatypes (even in a loosely typed language).
--
Vale,
Rob
Luxuria immodica insaniam creat.
Sanam formam viatae conservate!
http://www.rohanclan.com
http://treebeard.sourceforge.net
http://ashpool.sourceforge.net
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

