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

#1 2007-09-05 04:29:14

hoshantm
Scratcher
Registered: 2007-09-05
Posts: 6

Unary minus

Would it be possible to add the unary minus operator so that we can set a variable x to -x

Offline

 

#2 2007-09-08 10:08:50

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Unary minus

You can always do
[blocks]
(( 0 <-> x ))
[/blocks]

Offline

 

#3 2007-09-08 11:35:56

bigB
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: Unary minus

thats not clear to see.
0-x
or
-1 * x


http://scratch.mit.edu/projects/bigB/260981 Draw to Text
http://scratch.mit.edu/projects/bigB/181829 3D Stunt Flyer

Offline

 

#4 2007-09-08 16:22:05

andresmh
Scratch Team at MIT
Registered: 2007-03-05
Posts: 1000+

Re: Unary minus

bigB: I think he meant: 0-x


Andres Monroy-Hernandez | Scratch Team at the MIT Media Lab
on identi.ca and  twitter

Offline

 

#5 2007-09-08 21:57:47

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Unary minus

I agree---the blocks are often harder to read than the straight text.  I think I'll stop trying to use them.

Offline

 

#6 2007-09-10 04:34:29

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Unary minus

I usually use
[blocks]
(( -1 <*> number ))
[/blocks]

to change a positeve value to a negative one.

Last edited by Mayhem (2007-09-10 04:35:08)


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

Board footer