Discuss Scratch

BlueSkyGuy
Scratcher
7 posts

How to use Operators

What do you do with these?

SomethingmodSomething

roundSomething

SomethingofSomething
Charmind
Scratcher
500+ posts

How to use Operators

go to guestions about scratch
1. i don't know
2. if you hawe 1.11 it will make 1
3. position ?/ color of other sprite
Asymptoteles
Scratcher
29 posts

How to use Operators

BlueSkyGuy wrote:

What do you do with these?

SomethingmodSomething

roundSomething

SomethingofSomething

The first one is the “modulo” operation, or in other words: the “remainder of a division”.

Not sure about your mathematical background, so here's a short explanation:
Think, you want to share 6 apples among 4 people. 6 cannot be nicely dived by 4.
You can give out 1 apple to each, then you have 2 left. That's what the mod operator
calculates: 6 mod 4 is 2 . It's what remains, after having given each person the same
largest possible number of whole apples.

The division “() / ()” in Scratch is not limited to giving out whole numbers. If you
calculate 6 / 4, you'll get 1.5, which means each person gets one and a half apple.
To find out how many complete apples each one can get, you need to use the function
“floor” (in the same drop-down list as “round”).

setapplesto6setpersonsto4setapples_per_persontofloorofapples/persons is 1 with the .5 chopped offsetresttoapplesmodpersons is 2

I hope that helped.

If you use “round” instead of “floor” here, then you'd give each one 2 apples, that makes in total 8, which you didn't even have :-)

The
SomethingofSomething
is just the block where you can pick one of a couple of functions. You'll eventually learn at school what functions like “sin”, “cos”,… do.
BlueSkyGuy
Scratcher
7 posts

How to use Operators

Asymptoteles wrote:

BlueSkyGuy wrote:

What do you do with these?

SomethingmodSomething

roundSomething

SomethingofSomething

The first one is the “modulo” operation, or in other words: the “remainder of a division”.

Not sure about your mathematical background, so here's a short explanation:
Think, you want to share 6 apples among 4 people. 6 cannot be nicely dived by 4.
You can give out 1 apple to each, then you have 2 left. That's what the mod operator
calculates: 6 mod 4 is 2 . It's what remains, after having given each person the same
largest possible number of whole apples.

The division “() / ()” in Scratch is not limited to giving out whole numbers. If you
calculate 6 / 4, you'll get 1.5, which means each person gets one and a half apple.
To find out how many complete apples each one can get, you need to use the function
“floor” (in the same drop-down list as “round”).

setapplesto6setpersonsto4setapples_per_persontofloorofapples/persons is 1 with the .5 chopped offsetresttoapplesmodpersons is 2

I hope that helped.

If you use “round” instead of “floor” here, then you'd give each one 2 apples, that makes in total 8, which you didn't even have :-)

The
SomethingofSomething
is just the block where you can pick one of a couple of functions. You'll eventually learn at school what functions like “sin”, “cos”,… do.
The problem with saying that I'll learn at school what “sin” and “cos” do is that I'm homeschooled…
RafedAkeef
Scratcher
1 post

How to use Operators

I need help with operators!
flamingswordTEST
Scratcher
6 posts

How to use Operators


RafedAkeef wrote:

I need help with operators!
If in doubt, always check the Scratch Wiki first

http://wiki.scratch.mit.edu/wiki/Operator_Block should give you everything you need t know.
Paddle2See
Scratch Team
1000+ posts

How to use Operators

Since this topic hasn't seen a new post from the topic owner in a long time, I'm going to assume that it is dead and close the topic. If it still is alive, the topic owner just needs to use the Report button to ask a mod to reopen it

Powered by DjangoBB