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

#1 2010-03-22 07:37:11

Louis2018
Scratcher
Registered: 2008-06-13
Posts: 1000+

What does the "mod" block do?

What does it do?


http://img707.imageshack.us/img707/4547/louis2018.gif

Offline

 

#2 2010-03-22 07:55:45

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

Re: What does the "mod" block do?

I finds the remainder when you divide two numbers. For example, if you wanted to figure out if your variable was evenly divisible by 3, you see if <(variable)mod(3) = (0) >

Last edited by scmb1 (2010-03-22 07:56:03)


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

Offline

 

#3 2010-03-22 12:22:01

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: What does the "mod" block do?

scmb1 wrote:

I finds the remainder when you divide two numbers. For example, if you wanted to figure out if your variable was evenly divisible by 3, you see if <(variable)mod(3) = (0) >

Almost, but not quite, because in that case a negative dividend should result in a negative result, i.e.
-11 mod 2 = -1 (Try it on 'Calculator' if you have a Windows OS)
But Scratch returns a positive number.

Last edited by nXIII (2010-03-22 12:22:20)


nXIII

Offline

 

#4 2010-03-23 01:22:50

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: What does the "mod" block do?

If you don't know what a block does, right-click it and select Help. A window will show up, explaining what the block does.


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#5 2010-03-23 01:27:16

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: What does the "mod" block do?

http://reference.wolfram.com/mathematica/ref/Mod.html

Mod[m, n]
gives the remainder on division of m by n.


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#6 2010-03-23 06:49:14

Louis2018
Scratcher
Registered: 2008-06-13
Posts: 1000+

Re: What does the "mod" block do?

I get it now


http://img707.imageshack.us/img707/4547/louis2018.gif

Offline

 

Board footer