From: Jason Roelofs Date: 2008-01-30T07:15:45+09:00 Subject: Re: For Loop question Assuming you want to know where in the array said item is, this will do: @question_array.each_with_index do |part, i| if part.nil? count = i break end end otherwise the whole inner if can be simplified to "break if part.nil?" Jason On Jan 29, 2008 5:11 PM, Mark Mr wrote: > ok basically i cant quite figure out how to do a for loop i want in > ruby. 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 :) > -- > Posted via http://www.ruby-forum.com/. > >