To further clarify why you should use local = structNew().

 

If you have a function that sets variable x

 

And you forget to declare x as var

 

Then when you

 

<cfset x = 10 />

 

In a function, you are actually setting variables.x which is overriding the
instance variable X if it existed.

 

Regards

Dale Fraser

 

 <http://dalefraser.blogspot.com> http://dalefraser.blogspot.com

 

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Tuesday, 3 July 2007 4:25 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Function local variables scope

 

No it's not variables.

 

variables is CFC private

this is CFC public

 

Here's what you should do

 

<cffunction ....>

 

     <cfset var local = structNew() />

 

     <cfloop index="local.i" from="1" to="10">

           ...

 

     <cfset local.another = "Hello" />

 

This way 

 

1.  You can dump them

2.  You can not forget to var them thus they are all private.

 

Regards

Dale Fraser

 

http://dalefraser.blogspot.com

 

 

From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of AJ Mercer
Sent: Tuesday, 3 July 2007 4:08 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Function local variables scope

 

is it VARIABLES
or is that something completely different?

On 7/3/07, Chris Velevitch <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:


On 7/3/07, Dale Fraser <[EMAIL PROTECTED] > wrote:
>
> There is no local scope, what are you referring to.

I'm inside a function and I want to cfdump the functions local scope.



Chris
--
Chris Velevitch
Manager - Sydney Flash Platform Developers Group 
m: 0415 469 095
www.flashdev.org.au




-- 
If you are not living on the edge,
You are taking up too much space.



 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to