A downto iterator, which starts at a higher number and loops to a lower number.
grades = [88, 99, 73, 56, 87, 64] sum = 0 0.downto(0) do |loop_index| sum += grades[loop_index] end average = sum / grades.length puts average