Section B.9. Variables


B.9. Variables

HyperTalk and AppleScript have a lot in common when it comes to variables. In both languages, variables can hold similar kinds of informationstrings, numbers, and so on. And in both languages, you have to use the keyword global when you want the ability to access a particular variable from multiple subroutines in your script.

The difference comes when you want to assign a value to a variable. In HyperTalk, you use the keyword put, like this:

put 33 into myAge

In AppleScript, you can use put, toobut, because of habit, most people don't. Instead, the more popular AppleScript way of assigning variables is to use set, like this:

set myAge to 33

Now, go forth and script!



AppleScript. The Missing Manual
AppleScript: The Missing Manual
ISBN: 0596008503
EAN: 2147483647
Year: 2003
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net