From: Mateusz Tybura Date: 2008-10-16T20:03:00+09:00 Subject: Re: newbie to ruby, search an array Chris Ashton wrote: > hi, im fairly new to ruby and cud do with some help > > is there an easy way to search an array to see if it contains a desired > value > > thanks > > e.g. if @joe contains 'bloggs' return true and array location > > thanks Try this: tab = ["frogs","mugs","bloggs"] tab.index "bloggs" #=> returns index or nil if not found -- Posted via http://www.ruby-forum.com/.