In this case you are using a variable as strictly a Boolean. ;) Nothing wrong with that.
My preference on how to write the conditionals is already stated, however I will admit you do achieve good code readability in your examples. At 08:26 AM 11/11/2002 -0600, you wrote: >Jeff, > >How about a compromise. I often name variables that I'm going to use like >this for the benefit of readability - using the "IsXxxxxxx" convention. For >example, I might name a variable IsValidUser and populate it with true or >false - or I'm doing some kind of XORing, it might be calculated to hold a >zero or a non-zero. In either case, the IF statement reads nicely: > ><Cfif IsValidUser> > ...do something... ></cfif> > ><cfif NOT IsValidUser> > ... do something else... ></cfif> > >There's no confusion because the variable name is consturcted to go along >with a logic statement. What do you think? > >-mk > > >-----Original Message----- >From: Jeffry Houser [mailto:jeff@;farcryfly.com] >Sent: Monday, November 11, 2002 7:56 AM >To: CF-Talk >Subject: Re: Booleans > > >At 10:16 AM 11/10/2002 -0800, you wrote: > >You don't compare them to anything. You don't need to. They are > >*already* boolean. You say: > > > > <cfif someBooleanExpression> > > > >You shouldn't say: > > > > <cfif someBooleanExpression eq true> > > > >You say: > > > > <cfif not someBooleanExpression> > > > >You shouldn't say: > > > > <cfif someBooleanExpression eq false> > >or > > <cfif someBooleanExpression neq true> > > I want say that I find the second syntax more readable and >self-documenting. If someone is using true Booleans, I fail to see why it >matters. Using Integers as Booleans, on the other hand, just seems like a >bad practice to me. I do see it often enough, such as checking for the >length of a string like this: > > <cfif Len(MyString)> > Whatever > </cfif> > > It annoys me, because I would much rather see: > > <cfif (Len(MyString) is 0)> > Whatever > </cfif> > > The second is much more readable, in my opinion. > > >-- >Jeffry Houser | mailto:jeff@;farcryfly.com >DotComIt, Putting you on the web >AIM: Reboog711 | Phone: 1-203-379-0773 >-- >My CFMX Book: ><http://www.amazon.com/exec/obidos/ASIN/0072225564/instantcoldfu-20> >My Books: http://www.instantcoldfusion.com >My Band: http://www.farcryfly.com > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.