Abs
Returns the absolute value of a number.
Syntax
Abs(Val)
Parameters
Val
Type: Double
A numeric value.
(return)
Type: Double
Val with any negative sign removed.
Remarks
If Val is negative, the return value is -Val, otherwise the return value is Val. If the current data value is NULL, Val is 0.0 and the return value is 0.0.
This function is similar to the Abs function in VBScript.
Example
The following mrScriptBasic example uses the Abs function to get the absolute value of two numbers:
Dim MyPositiveNumber, MyNegativeNumber
MyPositiveNumber = Abs(150) ' Returns 150
MyNegativeNumber = Abs(-150) ' Returns 150
See also