-------------------------------1151929461 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit You can use the break command to stop iterating through a block, eg. (simplifying your commands a bit): file_names a.txt','b.txt','c.txt'] file_names.each do |x| if x b.txt' puts 'we already have ' + x + ' in that array ' break end end Best regards, Axel -------------------------------1151929461--