Everyone seems to forget this...just put a space between the else and if.
Also the parentheses are not required if you do not have more than one
condition.

<cfscript>
foo = 5;
if (foo = 1)
    bar = 1;
else if (foo = 2)
    bar = 2;
else if (foo = 3)
    bar = 3;
else
    bar = "duh ;-)";
</cfscript>

jon
----- Original Message -----
From: "Jamie Jackson" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, March 22, 2001 12:38 PM
Subject: Re: elseif in <cfscript>?


> Ugly... but I'll take it. Thanks,
> Jamie
>
> On Thu, 22 Mar 2001 11:59:56 -0500, in cf-talk you wrote:
>
> >Well, this:
> >
> ><cfif thisIsTrue>
> > code
> ><cfelseif thisIsTrue2>
> > code
> ></cfif>
> >
> >is really just another way of doing:
> >
> ><cfif thisIsTrue>
> > code
> ><cfelse>
> > <cfif isThisTrue>
> > code
> > </cfif>
> ></cfif>
> >
> >So in cfscript you can do:
> >
> ><cfscript>
> > if (thisIsTrue) {
> > code...
> > }
> > else {
> > if (thisIsTrue2) {
> > code...
> > }
> > }
> ></cfscript>
> >
> >
> >HTH,
> >
> >Jason
> >
> >----
> >Jason Aden
> >Allaire Certified Developer
> >[EMAIL PROTECTED]
> >www.wwstudios.com
> >
> >> -----Original Message-----
> >> From: Jamie Jackson [mailto:[EMAIL PROTECTED]]
> >> Sent: Thursday, March 22, 2001 11:43 AM
> >> To: CF-Talk
> >> Subject: elseif in <cfscript>?
> >>
> >>
> >> Is there no elseif in <cfscript>? If not:  Why not, and what's the
> >> usual workaround?
> >>
> >> Thanks,
> >> Jamie
> >>
> >>
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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