Check if it is Odd, Even, Rational, Irrational, whole, etc...

cwbh10cwbh10 Member Posts: 52
edited November -1 in Tech Support
I wanted to have a simple rule to check when the time passed when divided by a number say... 9 will be even/whole. So that everytime it reports even it changes a setting. I guess i could keep it whole by using integers? Help would be nice :)

Comments

  • xarmianxarmian Member Posts: 124
    Use modulous.. if (time % 9) = 0 then { do something }, mod is the remainder after dividing by the modulo number, so 10%9 = 1, 20%9 = 2, 9%9 = 0, 18%9 = 0, etc, so if you're doing seconds, then every 9th second time%9 = 0.
  • cwbh10cwbh10 Member Posts: 52
    Oh! Thanks! I can't believe didn't think of that... :p

    Have a good one! :)
Sign In or Register to comment.