Problem with declaring local variables
rcozens at pon.net
Wed Jun 7 09:49:39 CDT 2006
> Until now I've had the impression that global variables need to be
> whereas local variables do not.
That depends on whether one wants the value of the local variable to
persist during runtime:
* An undeclared local variable is initialized to empty every time the
handler is called.
* A declared local variable is initialized at startup. Each time a
handler referencing the variable is called, it contains the value it
had at the conclusion of the last call.
Also, the scope of undeclared variables is always limited to the
handler that contains them, whereas the scope of declared [outside the
handler] local variables encompasses the entire script that declares
them. [But only that script: unlike globals, declared local variables
with the same name in different scripts are different variables.]
CCW, Serendipity Software Company
"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."
More information about the use-livecode