Function Abs() Foundation

Determines the absolute value of a numeric expression.

Syntax
Abs( <nExpression> ) --> nPositive
Parameters
<nExpression>
<nExpression> is a numeric expression whose absolute value is determined.
Return

The return value of Abs() is a number >= 0 which represents the absolute value of <nExpression>.

Description

The numeric function Abs() always returns a numeric value as a positive number regardless of its sign.

Examples
Abs()
// The example shows results of the function Abs() 

PROCEDURE Main 
   nValue1 := 200 
   nValue2 := 500 
   ? nValue1 - nValue2              // result: -300 

   ? Abs( nValue1 - nValue2 )       // result:  300 
   ? Abs( nValue2 - nValue1 )       // result:  300 

   ? Abs( -500 )                    // result:  500 
   ? Abs( 0 )                       // result:   0 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.