From: Farrel Lifson Date: 2009-04-30T20:04:18+09:00 Subject: Re: find if an array has any element present in another array 2009/4/30 Charanya Nagarajan : > I have 2 lists > > a=[1,2,3,4] > b=[2,4,6,7,8] > > I want to find if there are any elements present in "a" which are also > present in "b". > I jus wanna "true" or "false" answer if both of the arrays have any > element in common. You can take the intersection of the two and see if it's empty. if (a & b).empty? puts( 'Nothing in common' ) else puts( 'Common elements') end Farrel -- Aimred - Ruby Development and Consulting http://www.aimred.com