Page 1 of 1
any way to clear all local variables at start of program
Posted: Fri Aug 16, 2013 4:15 pm
by PoLyGLoT
Hi all,
I use a lot of local variables in my programming. Instead of writing out "put empty into X" 50 times (1 for each variable), is there any way to put empty into all local variables at the start of a handler?
Thanks so much!!
Re: any way to clear all local variables at start of program
Posted: Fri Aug 16, 2013 4:48 pm
by PoLyGLoT
Greetings all,
I may have answered my own question. I realized that if you put:
local var1,var2,var3, etc.....
at the top of your handler, it will automatically clear them once it exits / re-enters said handler.
However, it would be nice to have a command to flush all local variables at the end of a handler just to be super duper sure they are all flushed out. Any such command?
Re: any way to clear all local variables at start of program
Posted: Sat Aug 17, 2013 4:18 am
by dunbarx
Hi.
Local variables are deleted from memory when the handler ends.
But there is a function, "the variableNames", that might be used to do what you want. You can take the list generated from that and clear whatever you want to,
Craig Newman
Re: any way to clear all local variables at start of program
Posted: Sat Aug 17, 2013 6:40 pm
by jacque
You don't even need to declare the variables in the handler if you don't want to. Variables are never preserved when the handler terminates. There's no need to remove them or worry about their memory usage. They always go poof.
In fact, the usual problem is that people wonder where the values went when the handler ends.
