Loop the loop with loop


#1

Hi everyone,
Im very new to this and Im having trouble wight he above noted topic. I have looked at the other topics to see if I could figure out this problem on my own but I am struggling. Please let me know what I am doing wrong. Thanks in advance!

This is what I have:

x = 0
loop do
x += 1
print "ruby!"
break if x == 30
end

any suggestions?


#2

Sorry for wasting your time, I figured it out. I needed to capitalize "Ruby!"


#3

thanks!
I was using the counter way but found that it didn't work unless i used:
break if x == 30 or break if counter == 30
it wouldn't work if i put: break if counter > 30


#4

they really need to quit with the kicker ! type stuff. spelling errors are not syntax errors so quit making me think my syntax is wrong by causing spelling errors. not funny. I am not learning from this just getting my self confused!!


#5

counter = 1 # have assign counter an integer, not zero
loop do
counter += 1
print "Ruby!"
break if counter > 30
end