Actually this kind of stuff has been used in C, and as far as I remember c++
and possibly java.  In c, there are no Boolean values, so 0 is false, and
everything else is true, and I don't remember if C++ introduced Booleans,
and I believe java does have Booleans, but in any of those languages, 0
should be counted as false and 1 as true.  

ColdFusion treats numbers the same way, and it's not just because of the
typeless nature of CF, but because that's how it's been in most other
languages, and it makes sense.  Perhaps if len(somevalue) eq 0 is easier to
read to some, but I think for most NOT len(somevalue) is just as clear.  

Russ

-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 27, 2005 11:36 AM
To: CF-Talk
Subject: Re: cfqueryparam and null values

I'd say that's a slightly kludgy hack that I only mention because the
'right' solution was proposed and overruled.  You're implicitly
coercing the numeric result returned by 'len' into a boolean value,
which works, because of the typeless nature of CF.  By using a numeric
comparison that returns boolean, you avoid implicit coercion, which
makes the code easier to read.  It's a subtle difference, but it's
worth that extra keystroke, IMHO.

cheers,
barneyb

On 4/27/05, Bryan Stevenson <[EMAIL PROTECTED]> wrote:
> >>
> >> This is also the technique I use.
> >
> > Of course I put "EQ 0" at the end there.
> 
> as Dave W corrected me yesterday :
> null="#YesNoFormat(NOT Len(Trim(FORM.txtFirstName))#">
> 
> I like the use of NOT instead of EQ 0 ...1 less keystroke ;-)
> 
> Bryan Stevenson B.Comm.

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204717
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to