Chapter 7. Variables
This chapter describes the rules for declaration, typing, initialization, naming, scoping, and lifetime of variables in the AppleScript language.
A variable is a binding between a name and a value. You can think of it as a shoebox with a label on it, into which something is placed for storage. The shoebox’s label is the variable’s name; what’s inside the shoebox is the variable’s value. For example, when we say:
set x to 5
it is as if we had a shoebox labeled “x” into which we place the number 5.
Assignment and Retrieval
To assign a
value to a variable is to put something into the shoebox. If the
variable already has a value, that value is replaced. Assignment is
performed with one of two commands:
set
or copy, described
here.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access