Stuck on The 'Until' Loop - Lesson 3


#1

https://www.codecademy.com/courses/learn-ruby/lessons/loops-iterators/exercises/the-until-loop?action=lesson_resume

I’m honestly just stuck on this one - the program infinitely loops over and over again, causing me to refresh the page. Mind if I get some help here?



counter = 1
until counter > 10
  puts counter
  i = 0
  until i == 6
    i = i + 1
  end
  
end
puts i



#2

You’ve misunderstood the instructions. You can’t just copy and paste the example here.

Here’s some pseudo code to form an outline
You have a counter set to one
until it is greater than ten
you want it to print the value of counter
then increment counter and start the loop over
then end

so lets fill in the code

#counter set to one
counter = 1
#tell the counter to run until it is greater than 10
until counter > 10
#print the value of counter
puts counter
#increment counter
counter = counter + 1 #counter now equals two and the loop starts over
end #the loop will run until counter > 10

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.