So you are interested in rounding a number to its lowest multiple. Let's say you want numbers to be rounded to 10:
>>> for number in range(30):
... print(f"{number}: {10 * (number // 10)}")
...
0: 0
1: 0
2: 0
3: 0
4: 0
5: 0
6: 0
7: 0
8: 0
9: 0
10: 10
11: 10
12: 10
13: 10
14: 10
15: 10
16: 10
17: 10
18: 10
19: 10
20: 20
21: 20
22: 20
23: 20
24: 20
25: 20
26: 20
27: 20
28: 20
29: 20
An aternative is to use a power of two instead of 10 -- say, 8. Then we subtract the number bit-and-ed with a mask (the power of two minus 1 -- 7, in our case):
>>> mask = 8 - 1
... for number in range(30):
... print(f"{number}: {number - (number & mask)}")
...
0: 0
1: 0
2: 0
3: 0
4: 0
5: 0
6: 0
7: 0
8: 8
9: 8
10: 8
11: 8
12: 8
13: 8
14: 8
15: 8
16: 16
17: 16
18: 16
19: 16
20: 16
21: 16
22: 16
23: 16
24: 24
25: 24
26: 24
27: 24
28: 24
29: 24
See how the numbers go up by 8 every 8 numbers? If you choose a power of two, then you get this result at very low computation cost.
Unfortunately, Scratch does not have bit-operators:
Instead, you can use the
mod
operator in Scratch:This also works for the original value of 50 that you were using: