Ruby Ruby Loops Build a Simple Contact List Methods That Return a Value


What is wrong here?

def parse_answer(answer, kind="string")
  answer = gets.chomp
  answer = answer.to_i if kind == "number"
  return answer

2 Answers

Hi Konstantinos,

Your codes look great except gets and chomp method in this line which should be delete because the challenge question didn't require this part.

  answer = gets.chomp


Maciej Czuchnowski
Maciej Czuchnowski
36,429 Points

Why do you do gets.chomp with the answer variable? It is being passed in as an argument already. Just remove that line and it will work.