Here's an example I posted in a recent thread that I think demonstrates the
importance of declaring local variables. It is for a UDF but applies to
methods in cfcs aswell:

<!--- UDF --->
<cffunction name="foo">
 <cfset i = 100>
 <cfreturn 'bar'>
</cffunction>

<!--- Calling template --->
<cfoutput>
 <cfset i = 1>
 <cfloop condition="i LT 10">
   <cfset bar = foo()>
   #i#<br />
   <cfset i = i + 1>
 </cfloop>
</cfoutput>

HTH

Dominic

Blog it up: http://fusion.dominicwatson.co.uk


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301356
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to