On 10/22/07, Shuaib Zahda <shuaib.zahda / gmail.com> wrote: > I was trying to overload one method but it does not work like Java. > I noticed it only uses the first method that it meets. There is no overloading in Ruby, only overriding, and the last definition overrides any previous definition. The case for what you're wanting is actually not that hard: class Summation def sum(*args) args.inject { |a, i| a + i } end end As you can see, for this particular sort of behaviour, you don't even need a method. *args, as well, allows for "infinite" arguments. Specific arguments can be reached with: class Summation def sum(first, *rest) rest.inject(first) { |a, i| a + i } end end -austin -- Austin Ziegler * halostatue / gmail.com * http://www.halostatue.ca/ * austin / halostatue.ca * http://www.halostatue.ca/feed/ * austin / zieglers.ca