On Wed, Apr 23, 2008 at 6:07 AM, Mohnish Chaudhary
<mohnish82 / rediffmail.com> wrote:

>  What I don't understand is how is "list[0]" working ? The syntax of
>  the method specified is "[](index)", so how come can we pass the
>  index within the braces instead of after it i.e shouldn't it be
>  "list.[](0)"?  But strangely, both work!

 That's Ruby syntax sugar.  When you define a method called "[]" which
 takes one argument you can call it like this:

 instance[arg]

 You can also define "[]=" taking two arguments which you can call it
 like this:

 instance[arg1] = arg2

 You can define "[]" taking two arguments and call it like this:

 instance[arg1, arg2]

 And so on...

 Marcelo