in reply to modulus question
To check if a number $day is divisible by divisor(3), use the modulus operator, %:
If the number divisible by 3 then the modulus will return remainder 0, so the if condition will fail so add your logic in else condition.
(OR)if ($day % 3) { # does not divide cleanly } else { # does. }
Even you can use the same as your if(($day%3) == 0) condition of checking the reminder is equal to 0. In this case you can add your logic in if(..) itself
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: modulus question
by GrandFather (Saint) on Feb 03, 2015 at 06:47 UTC | |
by vinoth.ree (Monsignor) on Feb 03, 2015 at 08:12 UTC |