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
puts “Not Found”
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