[thelist] ASP - if x = every nth?

Brian Cummiskey brian at hondaswap.com
Wed Jun 6 11:28:46 CDT 2007


Jon Hughes wrote:
> Thank you all for that :)
>
> What about if it's not even?
>
> Example:
>
> if i = 4 or i = 9 or i = 14 or i = 19 or i = 24 or i = 29 or i = 34 or i
> = 39 or i = 44 or i = 49 then
>
> if (I mod 4) = 0 then
>
> does not do the same thing.
it won't.   MODULUS is "remainder" math.

for example,

x= 25
if x mod  5 then
    '....
end if

25 goes into 5 5 times (exactly) with 0 remainder.
add one, 26 goes into 5 5 times, with 1 remainder.

so when you do your test for x mod whatever, it needs to  = 0 to be true 
(or, whatever you decide to set it equal to).

if your "step" between  (ie, 4 to 9, 9 to 14) is not a constant, (in 
this example, 5) modulus won't work.

even your subject line suggest's this :)   every nth is a constant N.




More information about the thelist mailing list