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! While you're at it, check out some resources Treehouse students have shared here.
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 trialalexx1000
16,187 PointsHello there! I'm in the Ruby Basics class doing the methods.rb challenge and I can't seem to get the answer right...
Is there anybody who has already finished this methods.rb exercise so I can understand what I'm supposed to do? Any help will be greatly appreciated! Thanks so much!
def three(number1)
print "Give me a number"
number1 = gets.chomp
end
def five(number2)
print "Give me a number"
number2 = gets.chomp
end
3 Answers
Lee Vaughn
Treehouse TeacherThe solution you used works but you could simplify it down to just:
def three
3
end
def five
5
end
Props on coming up with a solution!
Lee Vaughn
Treehouse TeacherAre you working on this code challenge?
If so the issue is that you are doing a little more than what the text in the code challenge is asking of you. Each of those methods should return a number, 3 and 5 respectively.
If your question is about a different part of the course please share a link to the lesson or code challenge and we can dig a little deeper.
alexx1000
16,187 PointsHi Lee Vaughn!
Thank you so much for your response! I finally figured out the response after several attempts lol
Here it is, hope it helps other students: def three number1 = 3 end
def five number2 = 5 end
three five
Apparently is correct because after the system evaluated it it allowed me to continue to the next video? is this correct? I really appreciate your prompt response and your time. You're very kind. Thank you so much!
Alex
alexx1000
16,187 Pointsalexx1000
16,187 PointsHi Lee Vaughn! Wow your solution is terrific!! thank you so much!!