Joshua Atteberry6,250 Points
Getting an error on "Build a simple contact list" challenge 1 of 1
The error is a "no such file or dir" error, which I'm guessing is generic for my code doesn't work.
It seems as if the code should work.
I get the input and assign it to the variable "answer".
I convert it to an integer with to_i.
And then I return it.
I tried submitting it with and without the puts statement outside the block. Nothing seems to work.
I also tried making the "answer" variable different from the "answer" argument as it is in the video example. This didn't work either.
Any help is much appreciated!
def parse_answer(answer, kind="string") answer = gets.chomp answer = answer.to_i if kind == "number" return answer end answer = parse_answer(" ") puts answer
Maciej Czuchnowski36,427 Points
You have more in your code than the challenge wants you to. This is the minimum passing code:
def parse_answer(answer, kind="string") answer = answer.to_i if kind == "number" return answer end
I'm not sure where the chomp came from and why you added things after the method. But you had the passing code there :)