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


Fill out the parse_answer method to return the answer passed in. If the kind is number, convert it to an integer using the to_i method before returning it.

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

2 Answers

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

Hi Abdi,

Let me give you hints - @2:21, that question expects you to use between 3 and 4 lines in that video example.

Hope that it will passed it.