17 loop the loop with loop


#1

counter = 0
loop do
counter += 1
print "Ruby!"
break if counter > 30
end
just keep getting error saying it isnt printing "Ruby!" 30 times
someone please help!
Quin

***I changed it to counter = 1 and it worked, can someone explain what just happened?


#2

When you start with your counter at 0 you should only be going up to 29 because 29 +1 = 30. When you set the counter to counter > 30, then it is doing one more iteration so that you end up with 31 Ruby!s instead of 30.