From: Tim Hunter Date: 2004-09-06T10:30:13+09:00 Subject: Re: nuby question rbrooks wrote: > Tim, > > Thanks for responding. namelist is just a list of words that I was then > going to sort. I realize Ruby has a sort method for arrays that takes care > of this very easily, (took me about half a second to figure that out and > get it to work, but I was just trying to hand code it to get more familiar > with the language. Sure it's nothing I would ever use again, but I find > the more I keep working with a language the quicker I begin to grasp it > and can begin to do something useful with it. Not sure if the > each_with_index method would help me here, but it seems apparent that I > need to really study Enumerable. > Ruby gives you the error message when you reach the last entry in namelist and you try to reference the last entry + 1. each_with_index would allow you to write the loop without maintaining a separate counter variable.