YoYo Games Wiki

abs(x)

From YoYoGames Wiki

Description

The abs() function in Game Maker is a mathematical function that returns the absolute value of the entered argument.

Arguments

Returns

(real): absolute value of x

Explanation

An absolute value of a number is defined as this number without a sign. That means that absolute value of any positive number equals to this number, while an absolute value of a negative number is a number without a ´minus´ sign. To be complete, the absolute value of 0 is 0.

Examples

Suppose the argument is 5, then abs(5) will return 5.

Suppose the argument is -5, then abs(-5) will also return 5.

See Also