From: Mark Van Holstyn Date: 2006-07-04T03:32:32+09:00 Subject: Re: Array loops: new thread ------=_Part_23383_17372491.1151951549956 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline If you just need to see if an element is contained in an array try this... secondarray.include?( '5' ) => true mark On 7/3/06, Dark Ambient wrote: > > I thought it would be better to start a new thread for my current > issue, since the old one is filled with code in various stages. > Apologies. Gives me a chance to ask more succinctly regarding the > core issue. > > This is just an example. > I have 2 arrays > > firstarray = ['1','2,'3','4','5'] > secondarray = ['1','2','3','4','5','6','7'] > > I'm looping through firstarray.each do |x| > go through some blocks. At some point, either the start of the outter > array or somewhere down in the conditional statements I need to find > out if elements of firstarray are in secondarray. The only way I can > fathom doing this right now is by starting another loop, i.e. > secondarray.each do |y|. Problem is this seems to create constant > problems where the outter loop / [0] element is going through the > entire inner loop before proceeding on. to it's next element. Maybe > as someone suggested earlier today to me, to use break. Haven't had > much luck with that yet. > > If this question makes sense, anyone have some suggestions , comments > or anything else that might be helpful ? > > TIA > Stuart > > -- Mark Van Holstyn mvette13@gmail.com http://lotswholetime.com ------=_Part_23383_17372491.1151951549956--