Ah, the wonders of weakly-typed languages.  Not to mention the 50/50
languages like CF.  ;)

Save yourself a world of troubles, treat CF as if it's strongly typed.  CFIF
only accepts boolean conditions (your 'bitPublish' is not a boolean), and
only compare like types (with some fudge for floating point to integer and
such).

Not sure where the blame lies, but CF's type system is hosed like a building
that's on fire.  Whether this specific situation that is common across
weakly-typed languages, or specific to CF, I don't know.  It seems to me
that CF should coerce the int to a boolean first, because boolean is the
"more strict" type, so both of your expressions would be true.

Cheers,
barneyb

> -----Original Message-----
> From: Nando [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 13, 2004 11:25 AM
> To: CF-Talk
> Subject: Strange inconsistancy evaluating True/False
>
> I just tripped over something a little strange ...
>
> <cfset bitPublish = 255>
>
> With EQ<br>
> <cfif bitPublish EQ true>
> true
> <cfelse>
> false
> </cfif>
>
> <br><br>
>
> Without EQ<br>
> <cfif bitPublish>
> true
> <cfelse>
> false
> </cfif>
>
> If you run this test code on CFMX 6.1, you'll see that the
> first case evaluates to
> false and the second evalutes to true.
>
> using a value of 1 evaluates both to true.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to