This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-05-07 20:24:16

iCode-747
Scratcher
Registered: 2009-11-21
Posts: 1000+

Is there a way for you to convert -5 to 5 quickly in Scratch?

Subject says all. Help!


-End Transmission-

Offline

 

#2 2010-05-07 20:27:36

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

Multiply by -1.

Offline

 

#3 2010-05-07 20:33:40

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

Or use abs(absolute value).

Offline

 

#4 2010-05-07 22:47:32

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

laser100 wrote:

Or use abs(absolute value).

Correct.

|-5|=5 makes sense to me
-5*-1 doesn't

Offline

 

#5 2010-05-08 00:27:09

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

ThePCKid wrote:

laser100 wrote:

Or use abs(absolute value).

Correct.

|-5|=5 makes sense to me
-5*-1 doesn't

Both work (although, I'm sure you know that) depending on the situation.
If you want to change the sign of a number, multiply by -1. But, if you just want to make a number positive (whether it's negative or positive to begin with), take the absolute value.


http://i48.tinypic.com/2z5pqad.png

Offline

 

#6 2010-05-08 07:21:20

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

Or do that.

[blocks]
  (( 0 <-> 5 ))
or
  (( 0 <-> -5 ))
[/blocks]

Last edited by meew0 (2010-05-08 07:21:46)


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#7 2010-05-08 08:32:45

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

Well, The absolute value of something will always make it positive. Multiplying by -1 will change it from positive to negative, or from negative to positive.

Offline

 

#8 2010-05-08 09:44:15

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

coolstuff wrote:

Well, The absolute value of something will always make it positive. Multiplying by -1 will change it from positive to negative, or from negative to positive.

Yes. Multiplying by -1 is almost always more useful. I can't begin to count the number of times I've used it in my projects.


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#9 2010-05-08 11:38:03

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

demosthenes wrote:

coolstuff wrote:

Well, The absolute value of something will always make it positive. Multiplying by -1 will change it from positive to negative, or from negative to positive.

Yes. Multiplying by -1 is almost always more useful. I can't begin to count the number of times I've used it in my projects.

Me too, but  because he/she asked to turn negative to positive, it works with abs.

Offline

 

#10 2010-05-08 11:42:50

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: Is there a way for you to convert -5 to 5 quickly in Scratch?

laser100 wrote:

demosthenes wrote:

coolstuff wrote:

Well, The absolute value of something will always make it positive. Multiplying by -1 will change it from positive to negative, or from negative to positive.

Yes. Multiplying by -1 is almost always more useful. I can't begin to count the number of times I've used it in my projects.

Me too, but  because he/she asked to turn negative to positive, it works with abs.

Yeah, I'm not sure whether iCode wanted only negative to positive or to flip the sign, so both answers are valid.


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

Board footer