Following was my exercise:

Ruby> ary = [1, 2, 3, 4, 5]
Ruby> ary.each_index {|i| print i, "\n"}
0
1
2
3
4
[1, 2, 3, 4, 5]
Ruby> (0..ary.size).each {|i| print i, "\n"}
0
1
2
3
4
5
0..5

Dat

>From: Dave Thomas <Dave / thomases.com>
>Reply-To: ruby-talk / netlab.co.jp
>To: ruby-talk / netlab.co.jp (ruby-talk ML)
>Subject: [ruby-talk:02092] Re: Array Gotchas
>Date: 22 Mar 2000 20:06:26 -0600
>
>"Dat Nguyen" <thucdat / hotmail.com> writes:
>
> > By chance, I also discovered a bug in the manual where it claims the
> > following are the same:
> >
> > each_index {...}
> > (0..ary.size).each {...}
> >
> > But they aren't. Do you see why?
>
>I'll bite. In what way are they different?
>
>
>Dave

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com