Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Stefanos Ntiaz-Kamprera2,588 Points
the exercise asks me to write a ruby program using the loop method to print the string "hi" 5 times which I tried
I can't seem to find the correct coding to solve the problem,i am clearly missing something!
def repeat(string, times) fail "times must be 5 or more" if times < 5 counter = 0 loop do print "hi" counter = counter + 1 if counter==5 break end end end
KRIS NIKOLAISEN54,939 Points
You aren't using the parameters in your code here:
replace the hard coded values with string and times and you should be good.