Remember btw that when foreaching over an array, the value you get is the number in the array, not the index.
modulo of a negative number can give some surprising results. A
negative index in that array would cause it to throw a range
error, so my guess is that's what you're getting. If you do
%array.length though it becomes an unsigned math and thus will
never be negative, explaining the different result.
- modulo Strangeness? Taylor Hillegeist via Digitalmars-d-learn
- Re: modulo Strangeness? Taylor Hillegeist via Digitalmars-d-learn
- Re: modulo Strangeness? Taylor Hillegeist via Digitalmars-d-learn
- Re: modulo Strangen... Taylor Hillegeist via Digitalmars-d-learn
- Re: modulo Strangeness? safety0ff via Digitalmars-d-learn
- Re: modulo Strangeness? Adam D. Ruppe via Digitalmars-d-learn