Re: difference between property and variable
Re: difference between property and variable
- Subject: Re: difference between property and variable
- From: Brian Johnson <email@hidden>
- Date: Mon, 10 Dec 2007 14:14:02 -0800 (PST)
On Mon, 10 Dec 2007, Justin Laden wrote:
Currently I am reading over Matt's O'Reilly book, and I could use a
better understanding of what separates a Property from a Variable.
I'm taking my life in my hands here, and I'll probably get slapped for
getting some of this wrong, but basically ... scope and persistence.
A property, declared at the beginning of a script has scope of the whole
script. A variable must be declared global to be given broader scope.
Further, a property persists between executions of a script-saved-as-an-
application. So if your script is just
property counter:0
on run()
set counter to counter + 1
display dialog counter
end run
each time you run it, it'll report an incremented value.
HTH.
-b.johnson, dept of architecture, university of washington, seattle
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden