Team LiB
Previous Section Next Section

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!

    Team LiB
    Previous Section Next Section