expect it to be Boolean!
_____
From: Lofback, Chris [mailto:[EMAIL PROTECTED]
Sent: 19 August 2004 15:24
To: CF-Talk
Subject: RE: Double Negative way of making decisions? Good?
But it is treated as boolean. 0 is false and anything else is true,
including -1 and 3. I use this principle all the time like this:
<CFIF qryFoo.RecordCount>
--Output records here--
<CFELSE>
No records found!
</CFIF>
Chris
-----Original Message-----
From: Robertson-Ravo, Neil (RX)
[mailto:[EMAIL PROTECTED]
Sent: Thursday, August 19, 2004 6:31 AM
To: CF-Talk
Subject: RE: Double Negative way of making decisions? Good?
Don't think there is any real performance advantage, its just coder
preference...
But Matt's way IMHO is incorrect in this instance as Compare can return 3
results and Matt is checking for a Boolean.
Compare can return -1,0 or 1 which is not Boolean.
_____
From: Michael Kear [mailto:[EMAIL PROTECTED]
Sent: 19 August 2004 11:24
To: CF-Talk
Subject: Double Negative way of making decisions? Good?
I've been taking a look at ContentMonger Lite CMS system, mentioned
elsewhere today by Matt Robertson (http://mysecretbase.com/CMLite_Home.cfm),
and I notice a lot of the decisions in the code are made by what seems to be
a double negative for me. Quite confusing until I got used to it. Is
there any performance or other advantage to doing it the way Matt does it,
or is it just a matter of style?
For example, ContentMonger has this:
<cfif not Compare(GetItem.SecureDisplay,"Y")>
Stuff .
</cfif>
Where I'd be more likely to put this:
<cfif GetItem.SecureDisplay EQ "Y">
Stuff .
</cfif>
If it's just a matter of style, that's no problem, although I think my way
is more readable and more readily understood, but if there is any other
reason to do it Matt's way I've got an awful lot of revision of code to do!!
Cheers
Mike Kear
Windsor, NSW, Australia
AFP Webworks
http://afpwebworks.com
_____
_____
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

