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.

Michael Speight
4,536 Pointshelp! i do not understand the question fully
def parse_answer(answer, kind="string") answer = gets answer = answer.to_i if kind == "number"
return answer
end
code i have tried
def parse_answer(answer, kind="string")
answer = gets
answer = answer.to_i if kind == "number"
return answer
end
2 Answers

Tom Sager
18,987 PointsThe value of answer is already assigned when the parse_answer is called. There is no reason to 'gets' it.

Jerome Doyle
8,855 Points"answer = gets" will get you input along with a default type of string. for example, when you assign "parse_answer("whatever") " it actually means ("whatever", "string") but, if you want to type a number parse_answer("1") the default type of the "1" is a string not a integer. however, if you give a description like("1","number")
it will convert "1" to a integer 1
Tom Sager
18,987 PointsTom Sager
18,987 PointsThe value of answer is already assigned when the parse_answer is called. There is no reason to 'gets' it.