• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Duration of local variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Duration of local variables


  • Subject: Re: Duration of local variables
  • From: Emmanuel <email@hidden>
  • Date: Wed, 23 May 2001 12:25:32 +0200

At 10:08 +0200 19/05/01, Marc K. Myers wrote:
>
>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

As you observe, the "run" handler is not really a handler. It runs in the
context of the script. Expect it to behave nearly as if there was no "on
run" nor "end run" line.

Emmanuel


References: 
 >Duration of local variables (From: "Marc K. Myers" <email@hidden>)

  • Prev by Date: Re: Counting the items in anested list
  • Next by Date: Photoscripter & Photoshop 6
  • Previous by thread: Duration of local variables
  • Next by thread: WWDC
  • Index(es):
    • Date
    • Thread