[Ruby] чет/нечет

Dmitry Morozhnikov dmiceman at mail.ru
Mon Feb 3 18:45:42 MSK 2003


On Mon, 3 Feb 2003, Ihar Viarheichyk wrote:

IV> Ну тогда этот вариант будет наиболее читаем:
IV> class Fixnum
IV>   def odd
IV>     self & 1 == 1
IV>   end
IV> end
IV> puts 35.odd
IV> puts 36.odd

прошу прощения, но почему Fixnum а не Integer? конечно у ruby  нет
full numeric tower, но все таки..

-- 
DM, Dmitry Morozhnikov, PGPKEY 0xB6C14D95




More information about the Ruby mailing list