How to test a value, or number, to see if it is a multiple of, say, X?

Hi,
How would you test a number to see if its a multiple of another number?

I want to test of, say, widget.x is a multiple of, say 100, or not.

Thanks!

Use the modulo operator in your condition to test for the remainder after division:

If widget.x % 100 equals 0

Some examples:

512 % 100 == 12
400 % 100 == 0
10 % 100 == 10
1 Like

Most excellent, thank you for the swift reply!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.