But the original query said there was a diff between <cfif myvar> and <cfif
myvar eq TRUE>, implying that some non-zero values return FALSE, or at least
NOT TRUE.
----- Original Message -----
From: "Tim Painter" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, April 18, 2001 7:28 AM
Subject: Re: <cfif myvar IS true> vs <cfif myvar>
> You're right. My bad....
>
> I think what it means is that if you say
>
> <cfif myvar>
> CF is basically saying "Does myvar have any value" so in essence, 0 would
> be FALSE and anything else would be TRUE
> ----- Original Message -----
> From: "Rich Wild" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Wednesday, April 18, 2001 7:04 AM
> Subject: RE: <cfif myvar IS true> vs <cfif myvar>
>
>
> > > CF equates TRUE as being the number 1 and False as being 0. So if you
> > > specify myvar to being anything other than 0 or 1, then the
> > > variable myvar
> > > is considered neither true nor false.
> >
> > With respect, this isn't actually true...
> >
> > Try this:
> >
> > <cfset this = 2>
> >
> > <cfif this>
> > TRUE
> > <cfelse>
> > FALSE
> > </cfif>
> >
> > evaluates to TRUE.
> >
> > If a numeric value is anything other than 0 then CF equates it to TRUE.
> This
> > also includes negative values... so -1 will also equate to TRUE.
> >
> >
> > -------------------------------------------------------
> > Rich Wild
> > Senior Web Designer
> >
> > -------------------------------------------------------
> > e-mango.com ltd Tel: 01202 587 400
> > Lansdowne Place Fax: 01202 587 401
> > 17 Holdenhurst Road
> > Bournemouth Mailto:[EMAIL PROTECTED]
> > BH8 8EW, UK http://www.e-mango.com
> > -------------------------------------------------------
> > This message may contain information which is legally
> > privileged and/or confidential. If you are not the
> > intended recipient, you are hereby notified that any
> > unauthorised disclosure, copying, distribution or use
> > of this information is strictly prohibited. Such
> > notification notwithstanding, any comments, opinions,
> > information or conclusions expressed in this message
> > are those of the originator, not of e-mango.com ltd,
> > unless otherwise explicitly and independently indicated
> > by an authorised representative of e-mango.com ltd.
> > -------------------------------------------------------
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: Tim Painter [mailto:[EMAIL PROTECTED]]
> > > Sent: 18 April 2001 11:58
> > > To: CF-Talk
> > > Subject: Re: <cfif myvar IS true> vs <cfif myvar>
> > >
> > >
> > > Bert,
> > >
> > > CF equates TRUE as being the number 1 and False as being 0. So if you
> > > specify myvar to being anything other than 0 or 1, then the
> > > variable myvar
> > > is considered neither true nor false.
> > >
> > > When you say <cfif myvar> it it is the same as saying <cfif
> > > myvar is TRUE>
> > > or <cfif myvar eq 1>
> > > likewise, <cfif NOT myvar> is saying <cfif myvar is FALSE>
> > > or <cfif myvar
> > > eq 0>
> > >
> > >
> > > ----- Original Message -----
> > > From: "Bert" <[EMAIL PROTECTED]>
> > > To: "CF-Talk" <[EMAIL PROTECTED]>
> > > Sent: Wednesday, April 18, 2001 6:19 AM
> > > Subject: <cfif myvar IS true> vs <cfif myvar>
> > >
> > >
> > > > There seems to be a difference in the outcome of <cfif
> > > myvar IS true> and
> > > <cfif myvar>, when myvar is a number but neither 0 nor 1.
> > > >
> > > > Is this a feature to be used, or a bug, or have i missed something?
> > > >
> > > > Bert
> > > >
> > > > ps save the code below as trueorfalse.cfm to see what i mean:
> > > >
> > > > <cfparam name="myvar" default="2">
> > > >
> > > > <cfoutput>
> > > >
> > > > <b>#myvar#:</b>
> > > > <cfif myvar IS true>
> > > > myvar IS true
> > > > <cfelseif myvar IS false>
> > > > myvar IS false
> > > > <cfelse>
> > > > cfelse (i.e. NOT "myvar IS true" OR "myvar IS false")
> > > > </cfif>
> > > > <br>
> > > >
> > > > <b>#myvar#:</b>
> > > > <cfif myvar>
> > > > myvar
> > > > <cfelseif NOT myvar>
> > > > NOT myvar
> > > > <cfelse>
> > > > cfelse (i.e. NOT "cfif myvar" OR "cfif NOT myvar")
> > > > </cfif>
> > > >
> > > > <form action="trueorfalse.cfm" method="post">
> > > > <input type="text" name="myvar" value="#myvar#">
> > > > <input type="Submit">
> > > > </form>
> > > >
> > > > </cfoutput>
> > > >
> > > >
> > > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists