From: Mark Mr Date: 2008-01-12T05:33:00+09:00 Subject: Loop question I'm trying to figure out an easier way to work with loops in ruby. Basically this is what i have now @this_question.answers.each do |a| missing_flag = true if (a.answer == row[cell]) reply.reply = a.id missing_flag = false end if (missing_flag) puts "Not Found" end end Is there any way to avoid using this flag method? I want to put a condition on the .each statement that says if no a.answers = row[cell] then dont do the reply.reply = a.id. I cant do an else because it would run the else after every element in the answers, and i only want it to be done after all of them have been run. BTW i'm kind of new to ruby. Any suggestions? thanks :) -- Posted via http://www.ruby-forum.com/.