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

#1 2012-02-28 20:40:20

phunmaster2000
Scratcher
Registered: 2011-03-12
Posts: 3

()^() block?

does anyone know if there is a block like (x)^(y) in scratch? if not, how would you do it in BYOB without having an infinite amount of "if" statements?

Offline

 

#2 2012-02-28 20:45:23

MrMonk999
Scratcher
Registered: 2011-12-17
Posts: 500+

Re: ()^() block?

when gf clicked
set <z> to (1)
repeat <y>
   set <z> to <<z> * <x>>

Last edited by MrMonk999 (2012-02-28 20:49:02)


http://i.imgur.com/CAMJe.png

Offline

 

#3 2012-02-28 22:33:10

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: ()^() block?

x^y = 10^ (y * log x)

That should work.

([10^] of ((y) * ([log] of (x))))
Edit: In response to your question, there isn't an actual block, but there is a suggestion to make that in Scratch Suggestions here

Last edited by MoreGamesNow (2012-02-29 18:31:39)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-02-29 11:35:34

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: ()^() block?

MrMonk999 wrote:

when gf clicked
set <z> to (1)
repeat <y>
   set <z> to <<z> * <x>>

Actually it'd need to be

repeat ((y)-[1])
But that doesn't work with decimals or negative numbers anyway.


Why

Offline

 

Board footer