Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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 Parker217,626 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.