Discuss Scratch

LXtricityGames
Scratcher
38 posts

What does 'mod' do?

What does this block do, exactly??
mod0

i feel like it has something to do with the
round
block, am I correct?
redzback
New Scratcher
100+ posts

What does 'mod' do?

Wikipedia wrote:

In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the modulus of the operation).

Given two positive numbers a and n, a modulo n (often abbreviated as a mod n) is the remainder of the Euclidean division of a by n, where a is the dividend and n is the divisor.

For example, the expression “5 mod 2” evaluates to 1, because 5 divided by 2 has a quotient of 2 and a remainder of 1, while “9 mod 3” would evaluate to 0, because 9 divided by 3 has a quotient of 3 and a remainder of 0.
https://en.wikipedia.org/wiki/Modulo
PPPDUD
Scratcher
1000+ posts

What does 'mod' do?

redzback wrote:

Wikipedia wrote:

In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the modulus of the operation).

Given two positive numbers a and n, a modulo n (often abbreviated as a mod n) is the remainder of the Euclidean division of a by n, where a is the dividend and n is the divisor.

For example, the expression “5 mod 2” evaluates to 1, because 5 divided by 2 has a quotient of 2 and a remainder of 1, while “9 mod 3” would evaluate to 0, because 9 divided by 3 has a quotient of 3 and a remainder of 0.
https://en.wikipedia.org/wiki/Modulo
Link
redzback
New Scratcher
100+ posts

What does 'mod' do?

PPPDUD wrote:

Link
I can't use links… I'm a “New Scratcher”
housemuseum
Scratcher
100+ posts

What does 'mod' do?

LXtricityGames wrote:

What does this block do, exactly??
mod0

i feel like it has something to do with the
round
block, am I correct?

basically means the remainder of a division

Last edited by housemuseum (Sept. 25, 2023 17:55:54)

han614698
Scratcher
1000+ posts

What does 'mod' do?

It returns the remainder after dividing something.
For example, would divide five by two, and then report the remainder of one.

This is one easy way to see if a number is odd or even -

Powered by DjangoBB