System.Abs(Decimal) Method

Version: Available or changed with runtime version 1.0.

Calculates the absolute value of a number (Decimal, Integer or BigInteger). ABS always returns a positive numeric value or zero.

Syntax

NewNumber :=   System.Abs(Number: Decimal)

Note

This method can be invoked without specifying the data type name.

Parameters

Number
 Type: Decimal
The input value.

Return Value

NewNumber
 Type: Decimal

Remarks

The system automatically converts all of the numeric data types for you.

Example

This example shows how to remove the sign from a negative numeric value.

var
    x: Decimal;
    y: Decimal;
    Text000: Label "x = %1, y = %2";
begin
    x := -10.235; // x is assigned a negative value  
    y := ABS(x); // y is assigned the value of x without sign  
    Message(Text000, x, y);  
end;

The message window displays the following:

x = -10.235, y = 10.235

See Also

System Data Type
Get Started with AL
Developing Extensions