If you use "var" keyword you declare the variable as local, so when the execution exit from the function the variable can be destroyed by garbage collector. If you don't use "var" keyword the variable is stored in variables scope and can be destroyed only at the end of caller page execution. So the use of "var" keyword is very important.
Bye Gualtiero ----- Original Message ----- From: "Chad Gray" <[EMAIL PROTECTED]> To: "CF-Talk" <cf-talk@houseoffusion.com> Sent: Monday, July 30, 2007 3:46 PM Subject: CFC defining vars >I have noticed in a lot of people's code for CFCs they set all of the >variables being used in the CFC like this: > > <cfset var foo = ""> > > Why? Is this just good programming practice? > > Also what scope are these variables in? variables.foo? > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284800 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4