17. with .times


Why did this work?

30.times{ print "Ruby!" } #loop #break


Not sure I understand your question. Are you asking why it works because you think it shouldn't?

__.times { do something }

is the correct way to use the .times method.

Or are you having trouble getting it to work?


Yes, but this exercise calls for using loop.


The reason that worked is because the console only looks for certain values inside it. Depending on how the lesson was programmed I guess it was only looking for your to pring "Ruby!" 30 times. Regardless of how. Your code reflects mine to the letter so I assume that's just how the lesson was meant to work.