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
I think my solution is correct for this question, how do I pass to the next section without penalty?
Here is my solution, but it says that I am incorrect...
def repeat(string, times) fail "times must be 1 or more" if times < 1 counter = 0 string = "hi" times = 5
if counter == times
counter += 1
def repeat(string, times) fail "times must be 1 or more" if times < 1 counter = 0 string = "hi" times = 5 loop do if counter == times break else puts string counter += 1 end end end
Steven Parker228,077 Points
Your loop code is actually good!
But you added some extra stuff above where the "# YOUR CODE HERE" line used to be that is changing what the function does.
Add only the loop code to the original boilerplate and you'll pass the challenge.
:-) Mel B.