Syntax
set aNum to 10 + 3.14
Return value
An integer if the left-hand operator is an
integer and the right-hand operand is either an
integer or can be coerced to an
integer; a real if either
operand is a real; a date if
the left-hand operand is a date object
Description
This operator is used to add two operands
together or to add time to a date value. It is
also used in scientific notation to denote a real
that is greater than or equal to 10,000.0, as in 1.0E+9 (this number
is one billion; see the description of the real
value type in Chapter 3). The addition operator is
not used to concatenate two strings (& is
responsible for that); neither does AppleScript provide anything like
a ++ operator. The following is an example
statement for incrementing a numerical variable in AppleScript:
set aNum to aNum + 1
Here are some examples of adding time to dates.
Examples
set mydate to (date "Saturday, January 1, 2000 12:00:00 AM")¬
+ 1000 (* adds one thousand seconds to the date *)
set mydate to (date "Saturday, January 1, 2000 12:00:00 AM") + (30 *¬ days)
(* adds 30 days to the date (you can also use the constants minutes, hours, or
weeks) *)
|