From: hazal Ates Date: 2010-09-09T04:04:25+09:00 Subject: Re: .gcd method in ruby 1.8.7 Stefano Crocco wrote: > On Wednesday 08 September 2010, hazal Ates wrote: >> |in my code i use .gcd method to find greatest common divisor of two int. >> | >> |like i= 12.gcd 44 >> |puts i >> | >> |but it says "not defined method" > > Without the "like" before i= (which I assume doesn't belong to your > program > since it produces a syntax error) your code works correctly for me with > ruby > 1.8.7-p302. > > Stefano thank you, but of course i wrote the code without "like". irb output as below ; irb(main):001:0> 12.gcd 44 NoMethodError: undefined method `gcd' for 12:Fixnum from (irb):1 from :0 -- Posted via http://www.ruby-forum.com/.