17. with .times


#1

Why did this work?

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

#2

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?


#3

Yes, but this exercise calls for using loop.


#4

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.