2.3. Basic Data Type Classes
AppleScript has built-in support for some basic data types that enable you to easily work with numbers, true/false values, strings, and dates in your programs. Many of these classes are described in the following sections. Lists and records are covered in detail in Chapter 6.
When I use the term data type or just type in this book, I'm referring to the class. For example, when I use integer data type and integer type, these terms are synonymous with the term integer class.
2.3.1. The string Class
In Chapter 1, you learned that you can write a string by enclosing a sequence of characters inside a pair of double quotes, like this:
"Programming in AppleScript is fun."
It makes sense that you can assign such a literal character string to a variable in your program, like so:
set myFirstMessage to "Programming in AppleScript is fun."
This statement has the effect of storing the literal character string "Programming in AppleScript is fun." inside the variable myFirstMessage. You can subsequently use this variable in situations where a string is required. For example, this program produces the same output as your second program in Chapter 1:
set myFirstMessage to "Programming in AppleScript is fun." display dialog myFirstMessage
Here the string you stored inside the variable myFirstMessage in the first statement of the program is given to the display dialog command to be displayed. It's as if you typed the literal string right on the display dialog command ...
Get Beginning AppleScript® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.