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

Donald Lobree
Donald Lobree
8,396 Points

Any ideas? I keep getting the parse_answer method doesn't return a string when given a string

Any ideas? I keep getting the parse_answer method doesn't return a string when given a string

ask.rb
def parse_answer(answer, kind="string")
  if kind = "number"
    answer.to_i
  elsif kind = "string"
    answer.to_s
  else
    answer    
  end
end

2 Answers

Eric Levy
Eric Levy
14,652 Points

You need two equal signs to evaluate "kind" in your conditional.

Donald Lobree
Donald Lobree
8,396 Points

Thank you, Eric. That did the trick!