Returns the sign of n.


GML Code Example


Argument Description
n The number to get the sign of.

Returns: Integer


This function returns whether a number is positive, negative or neither and returns 1, -1, 0 respectively. For example - sign(458) will return 1, sign(-5) will return -1 and sign(0) will return 0.


GML Code Example

y += sign(y - mouse_y);

The above code will add 1, -1 or 0 onto y depending on the result of y - mouse_y.

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