From: Dick Davies Date: 2008-01-30T07:29:43+09:00 Subject: Re: For Loop question question_array.each { |element| next if element.nil element.do_something } will call do_something() on every element in the array that isn't nil. If you just want to do something with the first non-nil element, you could do non_nil = element.find { |e| !e.nil? } non_nil.do_something On Jan 29, 2008 10:11 PM, Mark Mr wrote: > . Here's what i want to do in C++, with some ruby mixed in > > for (i = 0; @question_array[i].nil?; i++) > { > code here.... > } > > it's supposed to run until it finds an element of the array that isnt > blank and then stop. anyone know how to make a loop like this in ruby? > thanks :) -- Rasputnik :: Jack of All Trades - Master of Nuns http://number9.hellooperator.net/