How do I do this type of for loop in Ruby?
for(int i=0; i
array.each do |element| element.do_stuff end
or
for element in array do element.do_stuff end
If you need index, you can use this:
array.each_with_index do |element,index| element.do_stuff(index) end