Name

number

Allowed coercions

String
list with one item
integer to real
real to integer (unless real has a fractional part)

Syntax

set theNumber to 25 as number

Description

number is a synonym for real or integer. However, the class for a number with a decimal point will be a real, and the same goes for a whole number (its class will be integer). Here are some illustrations of this:

theNum is of class integer
Set theNum to 25 as number
theNum is of class real
Set theNum to 25.1 as number

In other words, the number data type can be used in AppleScript, but its actual class will be either integer or real.

Get AppleScript in a Nutshell 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.