Gambas Documentation - /lang/abs

/lang/abs

# Abs

Value = Abs ( Number AS Float )

Compute the absolute value of a number.

The absolute value of a number is its positive value, i. e. the absolute value of -7 is 7 and that of +7 is also 7.

### Examples

    Print Abs(-2.5)

    2.5

    Print Abs(0)

    0

    ' Abs() lets you easily find the difference between two values.
    value1 = 100
    value2 = 200
    Print "The difference is "; Abs(value1 - value2)
    value1 = -100
    value2 = 200
    Print "The difference is "; Abs(value1 - value2)

    The difference is 100
    The difference is 300

### See also

- Arithmetical Functions