From: Joel VanderWerf Date: 2010-08-05T05:47:31+09:00 Subject: Re: Default arguments problem Amir Ebrahimifard wrote: > Hi > How can I have a method with 3 arguments so that only second argument is > a default > argument for example: > > def sum(p,q=2,r) > puts p+q+r > end > > (I want to use from this method with only 2 arguments : first argument > and third argument ) Only with ruby 1.9: $ irb19 >> def sum(p,q=2,r) >> puts p+q+r >> end => nil >> sum(1,2,3) 6 => nil >> sum(1,3) 6 => nil >>