A Boolean value is a logical TRUE or FALSE. In some languages, this is
represented as 0 and 1 or 0 and non-zero, but that's an implementation
detail.

-----Original Message-----
From: Christopher Olive [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, July 16, 2002 10:33 AM
To: CF-Talk
Subject: RE: Writing efficient CFIF statements


but it IS a boolean.  1 and 0 are boolean yes and no (in most
languages).

chris olive

-----Original Message-----
From: Patrick McElhaney [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 8:59 AM
To: CF-Talk
Subject: RE: Writing efficient CFIF statements


If QueryResults is supposed to be a boolean, isn't
it better to make it a boolean? Doesn't that make
it easier to understand the intent of the code?

<cfset QueryResults = myQuery.RecordCount>
The above statement tells me that QueryResults holds
the number of records in the query. If I output
the variable, I'll get a number. 

<cfset QueryResults = (myQuery.RecordCount gt 0)>
This tells me that QueryResults is a boolean, and
represents whether the query has any records. If
I output the variable, I'll get "YES" or "NO."

Patrick

> -----Original Message-----
> From: Matthew Walker [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 16, 2002 8:25 AM
> To: CF-Talk
> Subject: Re: Writing efficient CFIF statements
> 
> 
> This thread is odd. As Tim pointed out earlier, any non-zero
> value evaluates as TRUE so you can just say 
> <cfif myQuery.RecordCount> and be done with it.
> That's far cleaner for the eye.
> 
> 
> ----- Original Message -----
> From: "Patrick McElhaney" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 17, 2002 12:20 AM
> Subject: RE: Writing efficient CFIF statements
> 
> 
> > Clean and fast:
> >
> > <cfset QueryResults = (myQuery.RecordCount gt 0)>
> >
> > Patrick
> > 


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to