Yes,  classic...-1 as true.... :-)



   _____  

From: Michael Kear [mailto:[EMAIL PROTECTED]
Sent: 19 August 2004 12:47
To: CF-Talk
Subject: RE: Double Negative way of making decisions? Good?

It treats zero as false, and the other two values as true.  You can tell
because the following both give the same result:

<cfif not Compare("Z","Y")>Stuff</cfif>

<cfif not Compare("Y","Z")>Stuff</cfif>

while

<cfif not Compare("Y","Y")>Other stuff</cfif>   gives a different result.

For my money though, the fact that it's a double negative means it's
sufficiently easy to get confused (for me anyway) and therefore to code
round the wrong way, that I'm going to stick with <CFIF variable NEQ "Y">.

Cheers
Mike Kear
Windsor, NSW, Australia
AFP Webworks
http://afpwebworks.com

________________________________________
From: Robertson-Ravo, Neil (RX)
[mailto:[EMAIL PROTECTED]
Sent: Thursday, 19 August 2004 9:28 PM
To: CF-Talk
Subject: RE: Double Negative way of making decisions? Good?

Erm....unless I read it wrong he is using Compare and it is this which is
comparing the string - The actual CFIF is checking for the value returned
back from this Compare which is going to be -1,0,1 which is not
Boolean.....the code Matt listed is checking for a boolean value (well he is
assuming its 1 or 0 / True / False).

I am not sure how CF treats -1 - i.e. does it treat it as False?  This is
classic case of using ColdFusion's typelessness to your advantage.

   _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to