abs

Returns the absolute value of a value.

Syntax:

GML Code Example

abs(val)


Argument Description
val The number to turn absolute.


Returns: Real


Description

This function returns the absolute value of the input argument, so if it's a positive value then it will remain the same, but if it's negative it will be multiplied by -1 to make it positive.


Example:

GML Code Example

x += abs (x - mouse_x)

This will add an amount equal to the absolute value of the current x position of the instance and the mouse x position.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here