Persistent Variables during recursion

Bob Sneidar bobs at twft.com
Thu Jan 26 15:04:29 EST 2012


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 calls itself, the variables are wiped as though a new set is made. If I declare them as global, then of course the value persists even after the last recursion terminates. The function has no idea if it is  the first time through or one of the iterations. Any idea how to get around this? 

Bob



More information about the use-livecode mailing list