[Tutor] Re: [Edu-sig] style question

Kirby Urner urnerk@qwest.net
Wed, 20 Feb 2002 15:55:17 -0800


At 12:10 AM 2/21/2002 +0100, Remco Gerlich wrote:
>On  0, "Michael P. Reilly" <arcege@speakeasy.net> wrote:
> > However, it is still a "bad idea" to add boolean values.
>
>However, a%2 isn't a boolean just because it's either 0 or 1. It's the
>remainder if a is divided by 2. And the sum of those remainders is
>obviously the number of nubmers that were odd.

In the example being criticized (mine), I was going
a%2==1, getting a boolean to count evens, which is
what we wanted to count, not the number of odds.

But the proposed alternative used the same boolean
test, but filtered out the falses, counting the
number of remainders.  What I'm not getting is why
adding 1s is worse than filtering out 0s and
counting how many are left.

Kirby