Yield to block


#1


https://www.codecademy.com/courses/ruby-beginner-en-L3ZCI/0/5?curriculum_id=5059f8619189a5000201fbcb


Someone tell me what i did wrong heres my code.

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

num = 5

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


Replace this line with your code.


#2

n is not a Proc, just a number.

def double(n)

That line is not needed.


#3

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