How to round down (not up)



Hi. I just wanted to know if, in Hopscotch, it’s possible to use math to remove decimals from a number.


So what you're saying is you want to round numbers down?

3.21 -> 3
5.99 -> 5
7.5 -> 7


If so, it's pretty easy. All you have to do is put this in your code:

(Random Value Here) - ((Same Random Value Here) % 1)

Fantastic Modulo(s?) and how to use It(them?)

Ok, thanks! I'll try that. I think I just came up with a method, but that's easier, and will work.
EDIT: it worked, thanks!


Fwiw - I typically use

Round (number - 0.5)

Note: works only for positive numbers. So I use this formula only if I know the number will be positive. Otherwise I'll use the formula Valgo already mentioned

number - (number % 1)





Just use the purple "round" block. Then add the variable you need in the block.
This helped me in my Spiral maker thing


That works, but only if the decimal is less than 0.5. If the decimal is 0.5 or greater, then it rounds up, which is not very useful for this scenario.


Ah, I see. You just want to remove, not round.
Percentages are the "Modulo" button, I'm pretty sure.


Yup, they are. :smiley:


Oh I didn't get that either :relaxed:
So it looks like this is like "flooring", or rounding down a number.