Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » What does the mod block do?
- random-buildblocks
-
49 posts
What does the mod block do?
None of my projects have the mod block because it wasn't important. How do i even use it? You will tell me to use scratch wiki but its too complicated i want short explanation
When i do:
The answer is 0 but when:
Answer is 0?! can you help me?

When i do:
((9) mod (3))
The answer is 0 but when:
((9) mod (10))
Answer is 0?! can you help me?

Last edited by random-buildblocks (June 18, 2022 18:45:58)
- musicROCKS013
-
1000+ posts
What does the mod block do?
It basically divides the first number by the second number and reports the remainder. For example
5 and 2
5-2-2=1
9 and 10
9-10=0 or no remainder
same with 9 and 3
9-3-3-3= there is no remainder
5 and 2
5-2-2=1
9 and 10
9-10=0 or no remainder
same with 9 and 3
9-3-3-3= there is no remainder
- random-buildblocks
-
49 posts
What does the mod block do?
Wait it was 9 not 0 dfor 2nd None of my projects have the mod block because it wasn't important. How do i even use it? You will tell me to use scratch wiki but its too complicated i want short explanation
When i do:((9) mod (3))
The answer is 0 but when:((9) mod (10))
Answer is 0?! can you help me?
- musicROCKS013
-
1000+ posts
What does the mod block do?
..? Wait it was 9 not 0 dfor 2nd
The mod block basically gets the remainder. Do you know what that is?
- TR_Borg
-
82 posts
What does the mod block do?
9 mod 10 gives the answer 9, not 0.
When dividing two numbers, the result is the quotient, and the leftover amount is the remainder. The mod operator gives the remainder as its answer.
9 / 3 = 3, remainder 0
So, 9 mod 3 = 0
9 / 2 = 4, remainder 1
So, 9 mod 2 = 1
9 / 10 = 0, remainder 9
So, 9 mod 10 = 9
When dividing two numbers, the result is the quotient, and the leftover amount is the remainder. The mod operator gives the remainder as its answer.
9 / 3 = 3, remainder 0
So, 9 mod 3 = 0
9 / 2 = 4, remainder 1
So, 9 mod 2 = 1
9 / 10 = 0, remainder 9
So, 9 mod 10 = 9
- hedgehog_blue
-
1000+ posts
What does the mod block do?
They're saying that the output they were actually getting for 9 mod 10 was 9, which makes sense, not 0, as they were confused by before...? Wait it was 9 not 0 dfor 2nd
The mod block basically gets the remainder. Do you know what that is?
Perhaps your post added to that confusion because you said that the false output of 0 was correct:
9 and 10
9-10=0 or no remainder
- quandlingling
-
1 post
What does the mod block do?
h
Last edited by quandlingling (Feb. 21, 2025 19:51:19)
- Discussion Forums
- » Help with Scripts
-
» What does the mod block do?