That is not exactly true.  <cfif myvar> will evaluate true for any non-zero
value (or the boolean true) while <cfif myvar is true> implies that the
comparison is being done on a variable that is a boolean and set to true.

<cfparam name="myvar" default=2>

<cfif myvar>
    <!--- true --->
</cfif>

<cfif myvar is true>
    <!--- false --->
</cfif>

DC

----- Original Message -----
From: "Tim Painter" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, April 18, 2001 06:57
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

Reply via email to