soufiane oucherrou614 Points
what's wrong with this code?
I tried this code on Atom and it works perfect but here gave me error. any suggestion ?
def parse_answer(answer, kind="string") print answer + " " sawel=gets.chomp.capitalize sawel=sawel.to_i if kind =="number" return sawel end puts parse_answer("whats your name")
I don't think there is a lot wrong with your code. I tried it out in my terminal by running
irb and it is definately returning the answer. But I think the coding challenge expects something different, which is confusing, because you are doing it (almost) exactly like the teacher showed you in the previous video. So maybe this is a problem in the question itself that TreeHouse should look at sometime?
I saw someone else who was also struggling a bit with this. They eventually solved it by just doing a normal if-else to return the answer. Maybe try this? You can see their answer in this post: https://teamtreehouse.com/community/methods-that-return-a-value-code-challengeruby-loops