Question about the 5th practice. (5/21)


#1

So this in theory is suppose to be correct.

On the third line I input a number I want to be doubled. Then it is sent to my fiction "double"
Then the number goes to the yield block, which is { |a| puts a*2 }
So the number got multiplied by two here.
Finally it is supposed to put a*2

But if you try the code, it puts the number side by side.
For example.
If I input 2,
it returns 22, rather than 4.

def double(a)
yield a
end
puts "Number?"
b=gets.chomp
double(b) { |a| puts a*2}

And the website says THE CODE IS RIGHT.
It allows me to get to the next topic, the green banner appears!!


#2

I guess it treats "a" as a string, so if you just type {|a| a*2}, without "puts" it should do the thing