Name
Abs Function
Syntax
result
= Abs(number
)
number
Use: Required
Data Type: Any valid numeric expression
A number or a string representation of a number.
Return Value
The absolute value of number
. The data type is the same as that passed to
the function if number
is numeric, and
Double if it is not.
Description
Returns the absolute value of a number (i.e., its unsigned
magnitude). For example, Abs(-1)
and Abs(1)
both return 1.
Rules at a Glance
number
can be a number, a string representation of a number, an object whose default property is numeric, or aNull
orEmpty
.If
number
isNull
, the function returnsNull
.If
number
is an uninitialized variable orEmpty
, the function returns zero.
See Also
Get VBScript in a Nutshell, 2nd Edition 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.