Matz writes:
>Finally, I got access to comp.lang.ruby.
Am I the only one left out in the cold?? My ISP uses
SuperNews (www.supernews.com) which is apparently not quite
up to speed...
>Dave Thomas <Dave / Thomases.com> writes:
>
>|Does anyone else think that Integer#odd? would be useful?
>
>Both
>
> n % 2 == 1
> (n ^ 1) == 1
>
>would work. Do we really need it?
>If I have to add odd?, I'd add even? too.
Well, even? and odd? make the intent much more explicit.
But how would you expect zero to work? I believe that zero
is considered even (something like: "an integer n is called *even* if
there exists an integer m such that n = 2m", so 0 = (2)(0) is even).
/\ndy