>> There have been a handful ( maybe a half dozen )
>> situations where I found
>> the <cftry> was extremely helpful in creating an easily
>> human read/writeable
>> codeblock where the only alternative I could think of
>> would have been a horrible mess of spaghetti code.

> Yes, that is true. There are extenuating circumstances for
> most abuses of a language :)

Isaac the Butcher of Fusion ... :)

> I'm sure you wouldn't even consider doing this:

> <cffunction name="factorial" returntype="numeric">
>       <cfargument name="n" type="numeric" required="true"/>
>       <cfif n le 1>
>               <cfthrow type="result" message="1"/>
>       <cfelse>
>               <cftry>
>                       <cfset factorial(n-1)/>
>               <cfcatch type="result">
>                       <cfset nfact = n * #cfcatch.message#/>
>                       <cfthrow type="result" message="#nfact#"/>
>               </cfcatch>
>               </cftry>
>       </cfif>
> </cffunction>

> <cfparam name="url.n" type="numeric" default="5"/>

> <cftry>
>       <cfset factorial(url.n)/>
> <cfcatch type="result">
>       <cfoutput>
>               factorial #url.n# is #cfcatch.message#
>       </cfoutput>
> </cfcatch>
> </cftry>

Of course not... For starters, there are existing UDF's on cflib.org to
handle factorials. :P And I'm not certain the syntax is correct, but then
it's MX and I haven't gotten to the new version yet, so I wouldn't know. :)

> "I can smell your brains!"
> -- Mittens the Kitten :
> http://www.matazone.co.uk/theotherside.html

lol... That's priceless -- most of that stuff is lame, but that first
mittens anim. is hillarious... Incidentally, one of the answers from the
Magic 8 Ball is "Tell people you can smell their brains, it's a good ice
breaker at parties."

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.

Reply via email to