Converting negative numbers

How would you change the sign of a negative number to a positive number?

Like, change -.6 to .6 or -.2 to 2

https://documentation.xojo.com/api/math/abs.html

Thank You.

Positive values will remain positive. If your goal is to switch the sign, multiply by -1. Positive becomes negative, negative becomes positive.

3 Likes

Good point. Abs in this case was the answer.

A shortcut for

d = d * -1

is

d = -d

And just for the curious, a longer d = ABS(d) alternative is

If d < 0 Then d = -d

Makes sense and perfectly clear.