An essential feature of AppleScript is coercion. Coercing a quantity into a given class is changing its class into a new one. To perform coercion use the as preposition:
set the_year to "2003" as integer
will store the integer number 2003 into the_year, coercing the string "2003" into an integer.
Whenever implicitly implied, AppleScript performs automatic coercions.
set the_year to 0 + "2003"
will store the integer number 2003 into the_year as well.
AppleScript is rather versatile concerning data types: keep in mind that a given AppleScript operator or function may support several data types in input.
|