#I still don't understand why we use modulo here to extract the last digit.

1 messages · Page 1 of 1 (latest)

eternal raptorBOT
#

<@&987246883653156906> please have a look, thanks.

rigid vector
#

make a concrete example and ull notice u dont get hands on the last digit with division

#

u dont want how often sth can divide sth else, u want the remainder after division. and that's modulo

#

example: 10 / 8 is 1

#

versus 10 % 8, which is 2

#

so when u have 123 and u want the 3, what u need to do is to see what remains after u divided 10 out of 123 as much as it fits into it

#

123 % 10 is 3. bc that's what remains after u divided 123 / 10

#

in other words, 123 % 10 is the same as (123 - (123 / 10))

onyx leaf
#

Thank you, now I understand, I was so confused.

cold vessel
#

Please don't delete your original post, as it might be useful for others. And you can close a resolved thread by using /help-thread close.