> On Monday, Oct 14, 2002, at 17:13 US/Pacific, S. Isaac > Dealey wrote: >> There is another way to simulate variables or ranges in a >> case statement with a cftry and cfcatch blocks...
> try/catch is a pretty heavy operation - you should only > use it for (unexpected) error cases, not normal operation... I guess I > How about: > <cfset caseval = -1/> >> <cfif myvariable gt x and myvariable lt y><cfset >> caseval="1"></cfif> >> <cfif listfindnocase(mylist,myvariable)><cfset >> caseval="2"></cfif> >> <cfif refindnocase(myregex,myvariable)><cfset >> caseval="3"></cfif> >> ... default case stuff here ... >> <cfswitch expression="#caseval#"> >> <cfcase value="1">... do stuff...</cfcase> >> <cfcase value="2">... do stuff...</cfcase> >> <cfcase value="3">... do stuff...</cfcase> >> </cfswitch> >> I've used try catch for a number of non-error handling >> items >> .. properly implemented, it works pretty well. Or at >> least it has for >> me. > Have you timed it? (I won't even start on the stylistic > implications of > this!) >> And this is much shorter, however, with the try block, >> you can do all >> kinds >> of crazy stuff in the in-between parts... > Yes, well, we won't talk about that Isaac, eh? I'll just > call for those > nice men in their white coats... :) > "I have always wished that my computer would be as easy to > use as my > telephone. > My wish has come true - I no longer know how to use my > telephone." > -- Bjarne Stroustrup > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~| > Archives: > http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 > Subscription: http://www.houseoffusion.com/index.cfm?sideb > ar=lists&body=lists/cf_talk > FAQ: http://www.thenetprofits.co.uk/coldfusion/faq > Signup for the Fusion Authority news alert and keep up > with the latest news in ColdFusion and related topics. > http://www.fusionauthority.com/signup.cfm Isaac Certified Advanced ColdFusion 5 Developer www.turnkey.to 954-776-0046 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.