• 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: difference between property and variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >difference between property and variable (From: "Justin Laden" <email@hidden>)

  • Prev by Date: Re: difference between property and variable
  • Next by Date: Re: What makes AppleScript difficult
  • Previous by thread: difference between property and variable
  • Next by thread: Re: difference between property and variable
  • Index(es):
    • Date
    • Thread