O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 a Null or Empty.

  • If number is Null, the function returns Null.

  • If number is an uninitialized variable or Empty, the function returns zero.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required