Tyler Proctor11,458 Points
I've compared this with code from the video and they appear to be doing the exact same thing. What am I missing?
I'm setting the answer to a string that the user enters, then converting it to an integer if it is a number, and then returning. I don't understand how this is incorrect. Does it want me to actually call the method as well?
def parse_answer(answer, kind="string") answer = gets.chomp answer = answer.to_i if kind == "number" return answer end
Jason AndersTreehouse Moderator 144,974 Points
You're pretty much correct, except you added something the challenge didn't ask for. The value for
answer is being grabbed when the function is called, so I'm not sure why you added
answer = gets.chomp. If you delete that line, the code will pass the challenge.
Keep Coding! :)