On Tue, Feb 18, 2014 at 5:05 AM, Raja gopalan <lists / ruby-forum.com> wrote:

> It allows me to the default value to the second argument of the
> function as shown above,but when I tend to assign default
> value to the first argument it throws the error as show below,

That's because you can't have any required parameters *after* any
optional ones.  Think about how the parser would know which one you're
trying to assign a value to.

Accepting a hash, with some default values inside your method, might
be a better option.

-Dave

-- 
Dave Aronson, the T. Rex of Codosaurus LLC (codosaur.us),
freelance software developer, and creator of these sites:
PullRequestRoulette.com, blog.codosaur.us, & Dare2XL.com.