Loop the loop with loop "break if 30"


#1

this worked...
m = "Ruby!"
loop do
30.times{ print "#{m}"}
break if 30
end
i'm sure it wasn't meant to like this though right?
yes it gets the answer but how does "break if 30" make any sense?


Loop the loop with loop
#2

It works because your 30.times is doing all the work. Then you break at the first break if 30 (since 30 will always return true).

times already is a loop itself, you don't need two loops here.