Re: Persistent Variables during recursion

2012-01-26 Thread Bob Sneidar
Thanks John I just had figured out that the way to do it was to pass the values as arguments in the recursion. Bob On Jan 26, 2012, at 12:34 PM, John Craig wrote: > Hi, Bob. Here's one way of doing it. In the first call, pIndex is empty, so > some initialization is performed. The paramete

Re: Persistent Variables during recursion

2012-01-26 Thread Alex Tweedly
Easiest way I know is to have - your variables be either global or script-local - add an additional parameter, used only for recursive calls. so for the public interface, used from anywhere else, you do something like put myFunction(a,b,c) into myVar but within the function itself, you do

Re: Persistent Variables during recursion

2012-01-26 Thread Pete
You need to pass the persistent variables as parameters to the recursive function. When you call the function for the first time, just make sure the variables are empty, then when you call it from within itself, they'll get passed with whatever the values are at the time of the call. Pete On Thu,

Re: Persistent Variables during recursion

2012-01-26 Thread John Craig
Hi, Bob. Here's one way of doing it. In the first call, pIndex is empty, so some initialization is performed. The parameters are all passed with each recursive call, but pSame is always the same value. HTH :) on mouseUp test "12345", 1, 99 end mouseUp command test pData, pChange, p

Persistent Variables during recursion

2012-01-26 Thread Bob Sneidar
Hi all. This is my first foray into recursive functions. There are two variables I would like to be persistent for as long as the script is running, but I want them to be empty the first time I call the recursive function. I have tried declaring the variables as local, but each time the function