I challenge someone to come up with an useful example. The one you
provided...

<cfset variables.isCorrectPW = form.password eq myQuery.password>
<cfif not variables.isCorrectPW>
        <cflocation url="login.cfm">
</cfif>

is a complete waste that can be better written as.

<cfif form.password neq myQuery.password >
        <cflocation url="login.cfm">
</cfif>

Again, there really is no reason to ever have a comparison in a <cfset>
tag and I challenge someone to prove otherwise.

-Matt

> -----Original Message-----
> From: Justin Scott [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, May 04, 2002 9:08 PM
> To: CF-Talk
> Subject: Re: <cfset var1 = or EQ var2>
> 
> > There really is no reason to ever have a comparison in a <cfset> tag
as
> > you can't do logic with it or assign the result to a value. Most
likely
> > the programmer made a mistake and since CF never threw an error, he
or
> > she didn't notice.
> 
> Actually, you can use operators to set a variable to a boolean value
if
> you
> want to...
> 
> <cfset variables.isCorrectPW = form.password eq myQuery.password>
> 
> .and then use that variable as a boolean during logic operations...
> 
> <cfif not variables.isCorrectPW>
>   <cflocation url="login.cfm">
> </cfif>
> 
> Why would someone want to do this?  Not sure..  I've never had a use
for
> it
> personally, but the functionality is there if you need it.  Simply
saying
> <cfset 1 eq 1> will have the expression be evaluated to true, but the
> result
> will simply be tossed out, as was happening to the original poster.
> 
> -Justin Scott, Lead Developer
>  Sceiron Internet Services, Inc.
>  http://www.sceiron.com
> 
> 
> 
______________________________________________________________________
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to