[thelist] ASP - if x = every nth?

Matt Warden mwarden at gmail.com
Wed Jun 6 15:18:36 CDT 2007


On 6/6/07, Phil Turmel <pturmel-webdev at turmel.org> wrote:
> > if (i - 4) mod 5 = 0 then
> >
> Jon,
>
> For readability when the offset is a constant, I'd move the
> offset to the right of the equals, like so:
>
> if i mod 5 = 4 then

The formulation I offered was because of readability. The option above
does not represent the offset and requires a deeper understanding of
the modulus operator. I rarely use this operator, so I would have to
actually work it out to see if it would work... which is why I suspect
you offered your evidence:

> 0,5,10,15,... "if i mod 5 = 0 then"
> 1,6,11,16,... "if i mod 5 = 1 then"
> 2,7,12,17,... "if i mod 5 = 2 then"
> 3,8,13,18,... "if i mod 5 = 3 then"
> 4,9,14,19,... "if i mod 5 = 4 then"


-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list