From: Li Chen Date: 2009-02-11T10:46:05+09:00 Subject: Re: how to do the recursion William James wrote: > def dec_to_binary num, result = [] > result << > if num.odd? > 1 > else > 0 > end > if num < 2 > result.reverse.join "" > else > dec_to_binary num/2, result > end > end > > > p dec_to_binary 254 Hi Will, I have one more question about the method call: When you define method dec_to_binary, you pass two parameters. But when you call the method, you only provide one parameter. Surprisingly Ruby doesn't complain it. How to explain this seemly inconsistancy? Thanks, Li -- Posted via http://www.ruby-forum.com/.