The Absolution Value Operator
-
Introduction
When a number is greater than 0, such as 3.5, we say it is a “positive” number; when a number is less than 0, such as -2.1, we say it is a “negative” number.
We can convert a negative number to a positive number using the “abs” operator.

If the input number is already a positive number, then the output number is the same as the input:
Example
Suppose a sprite is at the x position of -25, and we want to know its horizontal distance from the center of the stage. We can simply calculate it using abs(-25), which gives us 25.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login