----- Original Message ----- 
From: "kwatch" <kwatch / lycos.jp>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Monday, February 17, 2003 4:04 AM
Subject: even? and odd? methods in Integer class


> Why Integer class doesn't have 'even?' nor 'odd?' method?
> Of course, it is easy to define by myself.
> But I wonder why these methods are not included in Ruby
> by default?

Frankly, I would like to see this (at least odd?
since even? is just the opposite -- Pascal went
this route -- but I am showing my age when I 
mention that).

It's been discussed before, but I think Matz said
it was not needed often enough and/or was very
simple to implement anyway.

Of course, there are other more general choices
you could make also.

  count.mult?(n)  # is count a multiple of n?
  count.mod?(5,2) # is count mod 5 equal to 2?

The latter mod? method could have the second param
default to zero, so that it included the function
of mult? also.

Cheers,
Hal