If you don't explicitly assign a variable to a scope, then it's
automatically put into the VARIABLES scope. So in your example, you could
refer to your var as foo and it would be just fine.

Having said that, it's a best practice to explicitly scope your variables to
avoid confusion, and potential collisions.


andy

-----Original Message-----
From: Chad Gray [mailto:[email protected]] 
Sent: Monday, June 15, 2009 9:22 AM
To: cf-talk
Subject: scoping


Say you defined a local variable like this on a CFM page and it returns a
query object:

<cfset foo = application.foo.moo()>

Should I write out my variables like this when I out the query object?

#variables.foo.goo#

Or is this sufficient?
#foo.goo#







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323503
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