Jared Armes6,242 Points
Can't figure out how to return answer.
I have tried everything, but I just can't seem to figure this out. As you can see, I have nearly copied Jason's code from the previous video. My syntax is possibly incorrect; but I am having trouble understanding how the "ask" method works to begin with, and why we pass in those unique arguments that only resemble the contents of a Hash. If anyone can be kind enough to explain, I would greatly appreciate it.
def parse_answer ask(answer, kind="string") answer = gets.chomp answer = answer.to_i if kind == "number" return answer end
Tim Knight28,852 Points
You mostly have this correct. Since your getting
answer as an attribute passed into the method you don't need to use gets.chomp (which you'd use if you were passing it as a parameter to the script). Just remove that line and you should be fine.