Say number = 0, and number increases by 1 each second.
How would I check if number is equal to a multiple of 10 (e.g. do something when number = 10, 20, 30 etc.)
Say number = 0, and number increases by 1 each second.
How would I check if number is equal to a multiple of 10 (e.g. do something when number = 10, 20, 30 etc.)
if number % 10 == 0 then
--code
end
This checks to see it there is a remainder when the number is divided by 10. If not, run the code.
you need to check if the number is divisible by 10, you can do this by doing
if number % 10 == 0 then
end
and you can have this fire once the number changed by doing a .Changed event
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You can use the modulo operand: (a % 10 == 0)