initialize an static, local, script-wide variable to empty
erikhans08 at yahoo.com
Fri Apr 11 22:45:00 CDT 2003
--- Monte Goulding <monte at sweattechnologies.com>
> If you want to reset every time your main
> handler executes then you don't
> want a local variable in the object scope. You
> should just use parameters for
> this kind of thing.
> No. It's all about variable scope. A local
> declared within a handler has
> only handler scope. A local declared outsite
> the handler has object scope
> (all handlers in the object can access the
> variable). A global declared
> within a handler has only a handler scope
> within the object but can be
> declared and used in other handlers/objects. A
> global declared outsite the
> handler has object scope.
"handler scope" "object scope":
very useful, clarifying phrases.
put 125 into gValue
has been my approach. now to experiment!
(hope i don't blow everything up again.)
> To write good/maintainable code you should try
> to take advantage of variable
> scope while designing your scripts to use the
> minimum possible. The wider
> your variable scope the harder it is to see
> where the variable gets changed.
right, found that out the hard way.
on the other hand, a consistent use of names for
local variables has appeal. staying with:
local i,j,k, tTotal, tList, tHolder # etc.
lets me use the same variable names all
the time while keeping things within
handler scope. and having all of the variables
right there on the first line of the handler
is good, plus all of those unneeded object scope
sVariables in the debugger were a distraction.
thanks for the ideas.
erik at erikhansen.org http://www.erikhansen.org
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
More information about the use-livecode