From: Anurag Priyam Date: 2011-01-17T16:49:15+09:00 Subject: Re: Why Ruby Does Not Support Method Overloading? > class Person > >  def print_details(name) >    "Hey My Name is #{name}" >  end > >  def print_details(name,age) >    "Hey My Name is #{name} and #{age}" >  end > end You can use default arguments in this case. def print_details(name, age = nil) s = "Hey My Name is #{name}" s << " and age #{age}" if age puts s end A piece of advice - A function's name and action should match. In this case, you name the method print_detail but do not print it. Seems like you expect to use the return value elsewhere; call the method just 'details' in that case. > person1 = Person.new > puts person1.print_details("peter") > puts person1.print_details("pk",25) > >  I got The error  wrong number of arguments (1 for 2) (ArgumentError). Yeah. The second definition now binds to 'print_details'. >  Why Ruby does not support the method overloading ??? Thats the Ruby way. Ruby makes up for function overloading with its flexible argument processing ability, like Victor pointed out. -- Anurag Priyam http://about.me/yeban/