One option might be to selectively use your break; command in the switch
statement.

If muliple cases can do the same code try

<cfscript>
        switch (theVar){
                case "val1":{
                        setAVar = 'it was case 1';
                        break;
                }
                case "val2":
                case "val3":{
                        setAVar = 'it was case 2 or 3';                 
                        break;
                }
                case "val4":{
                        setAVar = 'it was case 4';                      
                        break;
                }
        }
</cfscript>

I _think_ from what I remember reading that it'll keep processing until
it hits a break;

Their might be a cleaner way to implement the case statements too, but
it works from my quick tests.

t

**********************************************************************
Tyler M. Fitch
Certified Advanced ColdFusion 5 Developer

http://isitedesign.com
**********************************************************************

-----Original Message-----
From: Gyrus [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 10, 2002 9:56 AM
To: CF-Talk
Subject: Re: multiple case values in switch statement in cfscript


----- Original Message -----
> Could anyone tell me if its possible to define multiple case 
> statements In a switch block in cfscript..
---------------------------

I don't think this is possible. If you get an error when you try it,
that would confirm things :-)  I think it might be to do with CFScript
being kept as close as possible to JavaScript. Use <cfswitch> if
necessary...

Gyrus
[EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://www.norlonto.net
PGP key available


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to