Index

asint

asint (<-floatval) ->intval

Description

Converts (coerces) an item on the stack to an integer, and pushes it back to the stack.

If used on a float, will truncate any decimal value. i.e. 42.8 asint will return 42. If used on a string, if the string could be numeric (eg. “42”), it will be converted to the corresponding value, if not, the call will return zero.

Examples

Trace (AsInt(42.6))        # 42
Trace (AsInt("42"))        # 42
Trace (AsInt("Forty-two")) # 0

See also:

Index