>From a computer science perspective, it's best to only have one exit from a
function because it makes proving code correctness much much easier (i.e. a
block of code has only one entry point and only one exit point). With that
said,
it's really only a matter of personal preference (when was the last time
someone
asked you to prove that your algorithm was correct?), and sometimes its just
easier to just bail out with a return statement (for instance, checking in
nested
loops for a value).
This is how I would typically code though:
<cfif cow is "spotted">
<cfset retString = "cow is spotted">
<cfelse>
<cfset retString = "cow is not spotted">
<cfreturn retString>
-d
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
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
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4