Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Opposite of Absolute Value
- Zero0111
- Scratcher
100+ posts
Opposite of Absolute Value
Since the math block if you choose ABS (Absolute Value) it makes any negative number to a positive number but is there a block that makes it so any positive number changes into a negative number? For example if the number was 3 it would turn into -3 is there a way to do that?
- TONYflashB
- Scratcher
100+ posts
Opposite of Absolute Value
Just do
The 0- changes negative to positive and positive to negative.
Hope that helps
((0) - ([abs] of (number)))
The 0- changes negative to positive and positive to negative.
Hope that helps
- helloworldbyeworld
- Scratcher
1000+ posts
Opposite of Absolute Value
You can also flip the sign by multiplying by -1 (it’s more understandable than 0-number for me):
That way, if the number is positive, it will flip the sign, but if not, it will leave it as it is.
(([abs v] of (your number::grey)::operators) * (-1))
That way, if the number is positive, it will flip the sign, but if not, it will leave it as it is.
Helloworldbyeworld | 1200+ posts
Have a great day
- Discussion Forums
- » Help with Scripts
- » Opposite of Absolute Value