docs.intersystems.com
Home / ObjectScript Reference / ObjectScript Functions / $ZABS


ObjectScript Reference
$ZABS
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


Absolute value function.
Synopsis
$ZABS(n)
Parameter
n Any number.
Description
$ZABS returns the absolute value of n.
Parameter
n
Any number. Can be specified as a value, a variable, or an expression. The expression is evaluated, and the result converted to a positive value. Multiple plus and minus signs are permitted. Leading and trailing zeros are deleted.
For evaluation of mixed numeric strings and non-numeric strings, refer to Strings As Numbers in Using ObjectScript.
Example
The following example returns the absolute value of the number you supply:
   READ "Input a number: ",num
   SET abs=$ZABS(num)
   WRITE "The absolute value of ",num," is ",abs
See Also


Previous section           Next section
View this book as PDF
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-02-18 22:53:32