Name
abs — Return the absolute value of a number
Usage
Lang.abs(num)
: Numbernum
Description
If num
is an integer or can be converted
to one, returns a positive integer. Otherwise, if
num
is a floating-point value or can be
converted to one, returns a positive floating-point value.
Examples
Lang.abs(17)
returns integer 17
Lang.abs("-17")
returns integer 17
Lang.abs(2.3)
returns floating-point 2.3
Lang.abs(-2.3)
returns floating-point 2.3
Lang.abs("foo")
returns invalid
Get Learning WML, and WMLScript 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.