Math.Abs(Value)
The .Abs() method returns the absolute (positive) value of the Value supplied.
Applies To
Description
Properties and Methods
None
Available
The .Abs(Value) method is available in:
- 15.03.016
- All newer builds
Type
Decimal
Syntax
Math.Abs(Value);
Parameters
Parameter |
Required |
Description |
---|---|---|
Value |
Yes |
Any integer or decimal number that is positive or negative, the keyword null, or any text that can be converted to a numeric value. Any values outside the ranges above will result in a scripting error. |
Example
var lcMath = 'Math.Abs(-2.56): ' + Convert.ToString(Math.Abs(-2.56)) + '\n';
lcMath += 'Math.Abs(2.14): ' + Convert.ToString(Math.Abs(2.14)) + '\n';
lcMath += 'Math.Abs(null): ' + Convert.ToString(Math.Abs(null)) + '\n';
lcMath += 'Math.Abs(\'1\'): ' + Convert.ToString(Math.Abs('1')) + '\n';
lcMath += 'Math.Abs(\'-5.6\'): ' + Convert.ToString(Math.Abs('-5.6'));
Event.Form.MessageBox(lcMath);
/* Expected System Prompt Display:
Math.Abs(-2.56): 2.56
Math.Abs(2.14): 2.14
Math.Abs(null): 0
Math.Abs('1'): 1
Math.Abs('-5.6'): 5.6
*/