Subject: Re: Array index question
From: David Springer <dnspringer@ a . m
Date: Fri, 26 Feb 2010 07:13:20 +0900
References: 358060358064358065
In-reply-to: 358065
after some inspiration from Luc I was able to come up with this:
textlist = ["Apple", "Orange", "Lemon", "Grape", "Orange",
(0..textlist.length-1).select {|i| textlist[i] == "Orange"}[1]
--
Posted via http://www.ruby-forum.com/.