Yield to block



Someone tell me what i did wrong heres my code.

def double(&n)
puts "Lets double this"

num = 5

num.double(8) { |n| puts n * 2 }

Replace this line with your code.


n is not a Proc, just a number.

def double(n)

That line is not needed.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.