Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » What does mod do in scratch?
- Yunusmohd
-
Scratcher
11 posts
What does mod do in scratch?
All I Know about mod that it does a module
- Jlerpy
-
Scratcher
1000+ posts
What does mod do in scratch?
Here, it refers to MODULO, which is basically “if I divide this number by x, what's the leftover?”. So for instance, if you do something with modulo 2, then if it returns 0, that means it's an even number.
Last edited by Jlerpy (Nov. 18, 2023 23:20:39)
- housemuseum
-
Scratcher
100+ posts
What does mod do in scratch?
following on to what @Jlerpy said, if a variable reaches higher than the number you want to use for the mod block, it will restart.
- Jlerpy
-
Scratcher
1000+ posts
What does mod do in scratch?
Yes, so for example, if you were to use mod 3:
1 = 1
2 = 2
3 = 0
4 = 1
5 = 2
6 = 0
7 = 1
and so on
1 = 1
2 = 2
3 = 0
4 = 1
5 = 2
6 = 0
7 = 1
and so on
- medians
-
Scratcher
1000+ posts
What does mod do in scratch?
This stands for “modulo”:



Also, this can be used to detect even and odd numbers since even mod 2 results in 0, odd mod 2 results in 0.



Also, this can be used to detect even and odd numbers since even mod 2 results in 0, odd mod 2 results in 0.
- q-q-q-q-q-q-q-q-q-q-
-
Scratcher
15 posts
What does mod do in scratch?
It's just a fancy way of saying remainder.
Remember in early division, when you didn't know what to do with the smaller part of the number? Like if I had 47 and I had to divide it by 7, I would get 6 and then a remainder of 5.
Therefor, ((47) mod (7) is 5, because 5 is the remainder.
Remember in early division, when you didn't know what to do with the smaller part of the number? Like if I had 47 and I had to divide it by 7, I would get 6 and then a remainder of 5.
Therefor, ((47) mod (7) is 5, because 5 is the remainder.
- Vader_Eternal
-
Scratcher
96 posts
What does mod do in scratch?
Lets say it's x mod y. Imagine a clock with a number of hours equal to y. Then, starting at 1, you move x hours. Lets say it's 8 mod 5, then the clock has 5 hours, and you count 8 numbers, going: 1, 2, 3, 4, 0, 1, 2, 3. 8 mod 5 = 3. Just so you know, a real life clock is x mod 12.
Vader_Eternal
Vader_Eternal
Last edited by Vader_Eternal (Nov. 20, 2023 08:40:41)
- Discussion Forums
- » Help with Scripts
-
» What does mod do in scratch?