Duration of local variables
Duration of local variables
- Subject: Duration of local variables
- From: "Marc K. Myers" <email@hidden>
- Date: Sat, 19 May 2001 04:08:26 -0400
- Organization: [very little]
If I run the following script repeatedly in Script Editor or as an
applet, the variable xPrime in the run handler increments. The variable
xPrime in the reset() handler does not. Can anyone tell me why? I
didn't expect the value of a local variable to be retained from
execution to execution. I'm using AS 1.6 under OS 9.1.
on run
try
set xPrime to xPrime + 1
on error
set xPrime to 1
end try
reset()
display dialog "[run] " & (xPrime as text)
end run
on reset()
try
set xPrime to xPrime + 1
on error
set xPrime to 1
end try
display dialog "[reset] " & (xPrime as text)
end reset
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[5/19/01 4:02:17 AM]