From: Saravanan Krishnan Date: 2011-03-25T16:37:58+09:00 Subject: Re: break from select Hi venkat, Here is the better solution, a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] b = [] a.each do |x| next if b.length >= 5 b << x if x % 2 ==0 end puts b Cheers, Sarav Venkat Surabhi wrote in post #989142: > Thanks Saravanan for your reply. I thought of doing this . > But the problem is array size. Here I defined array with 15 elements. > What if we have 1000 of elements in array. -- Posted via http://www.ruby-forum.com/.