317
integer()
Syntax
(
numericExpression
).integer
integer(
numericExpression
)
Description
Function; rounds the value of
numericExpression
to the nearest whole integer.
You can force an integer to be a string by using the
string()
function.
Examples
This statement rounds off the number 3.75 to the nearest whole integer:
put integer(3.75)
-- 4
The following statement rounds off the value in parentheses. This provides a usable value for the
locH
sprite property, which requires an integer:
sprite(1).locH = integer(0.333 * stageWidth)
See also
float()
,
string()
integerP()
Syntax
expression.integerP
(
numericExpression
).integerP
integerP(
expression
)
Description
Function; indicates whether the expression specified by
expression
can be evaluated to an
integer (
1 or TRUE
) or not (
0 or FALSE
). P in
integerP
stands for predicate.
Examples
This statement checks whether the number 3 can be evaluated to an integer and then displays 1
(
TRUE
) in the Message window:
put(3).integerP
-- 1
The following statement checks whether the number 3 can be evaluated to an integer. Because 3
is surrounded by quotation marks, it cannot be evaluated to an integer, so 0
(FALSE
) is displayed
in the Message window:
put("3").integerP
-- 0
This statement checks whether the numerical value of the string in field cast member Entry is an
integer and if it isn’t, displays an alert:
if field("Entry").value.integerP = FALSE then alert "Please enter an integer."
See also
floatP()
,
integer()
,
ilk()
,
objectP()
,
stringP()
,
symbolP()
Summary of Contents for DIRECTOR MX-LINGO DICTIONARY
Page 1: ...Lingo Dictionary Macromedia Director MX...
Page 756: ...Index 756...