Syntax
set aNum to 10 / 3.14
Return value
If you use / or ÷ the result is always
a real value type. If you use
div, the result is always an
integer.
Description
The three division operators differ in that / and
÷ produce real value types, whereas
div always returns an integer.
div is the opposite of mod. For
example, 10 div 3 results in 3 and the remainder of 1 is ignored; 10
mod 3 results in 1 (the remainder) and the 3 result is ignored. You
produce the ÷ character by typing
option-/. Remember not to confuse the
/ division operator with the \ escape character
that is used to produce string characters such as a
tab (\t) or return (\r).
Examples
10 / 3 -- returns 3.333333333333
10 div 3 -- returns 3
10 mod 3 -- by way of comparison, returns 1
|