From: James Edward Gray II Date: 2006-06-07T22:19:24+09:00 Subject: Re: Getting rid of a while loop On Jun 7, 2006, at 7:53 AM, Tait Pollard wrote: > I get a feeling there should be another way to make this happen > without > using a while loop, if anyone has any ideas that'd be great. > > while question=file.gets > answer=file.gets > @question_array[counter]=Questions.new(question,answer, false) > counter+=1 > end One way would be: require "enumerator" # ... file.each_slice(2) do |question, answer| @question_array << Questions.new(question, answer, false) end Hope that helps. James Edward Gray II