ABS( ) Function

Returns the absolute value of the specified numeric expression.

ABS(nExpression)

Parameters

  • nExpression
    Specifies the numeric expression whose absolute value ABS( ) returns.

Return Value

Numeric

Example

? ABS(-45)       && Displays 45
? ABS(10-30)     && Displays 20
? ABS(30-10)     && Displays 20
STORE 40 TO gnNumber1
STORE 2 TO gnNumber2
? ABS(gnNumber2-gnNumber1)     && Displays 38

See Also

Reference

INT( ) Function
ROUND( ) Function
SIGN( ) Function

Other Resources

Functions
Language Reference (Visual FoxPro)