My background is Perl where this kind of boolean evaluation is common and I
still use it extensively in my CF code.  AFAIK, all boolean evaluations
treat zero as false and any other numeric value as true.  I use it wherever
I know the values will be numeric.  For example, I use this quite often:

<CFIF NOT qMyQuery.RecordCount>
   No data found!
<CFELSE>
   <CFOUTPUT QUERY="qMyQuery">
      ...
   </CFOUTPUT>
</CFIF>

I guess one argument against this format is that if you spell out the
boolean condition it is self-documenting.  But to me, this is a convenient
shortcut and more a matter of style than anything else.

Chris Lofback
Sr. Web Developer

TRX Integration
28051 US 19 N., Ste. C
Clearwater, FL  33761
www.trxi.com



> -----Original Message-----
> From: Stephen Moretti [mailto:stephen@;cfmaster.co.uk]
> Sent: Friday, November 08, 2002 11:19 AM
> To: CF-Talk
> Subject: Re: Studio MX
> 
> 
> <cfmode type="pedant">
> > 
> > And, really, I would use this:
> > 
> > <cfif Len(Form.Formname)>
> > 
> 
> should be 
> 
> <cfif Len(Form.Formname) GT 0>
> 
> BECAUSE Len() DOES NOT RETURN A BOOLEAN!
> 
> </cfmode>
> 
> I'll go away now..
> 
> Stephen
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to