From: Jenny Purcell Date: 2007-07-22T14:15:01+09:00 Subject: Re: Method to return elements of an array in numeric 'rank'? On Sun, 22 Jul 2007 13:52:15 +0900, "Harry Kakueki" wrote: >On 7/22/07, Jenny Purcell wrote: >> >> I realize it would be easier for people in the fgroup to follow if I >> was programming with objects. However, I just don't understand OO >> programming, my skills (such as they are) are procedural. >> >> Ruby was pointed out to me as a language that would allow me to write >> procedural programs and so far it is working out very nicely in that >> regard. >> > >Would something like this work? > >arr = [[1,7],[3,2],[4,9],[2,3]] # [[horse,score],[horse,score] etc.] >arr.sort! {|x,y| y[1] <=> x[1]} >p arr It looks like you're suggesting a two dimensional array, is that correct? I think that would also work, although I'm not quite good enough with Ruby syntax (or arrays) to follow it 100%. Jenny