Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, January 17, 2013

Codecademy Sample Solution: Yielding With Parameters



def yield_name(name)
  puts "In the method! Let's yield."
  yield name
  puts "Block complete! Back in the method."
end

yield_name("Eric") { |name| puts "My name is #{name}." }

# Now call the method with your name!

yield_name("Jim") { |name| puts "My name is #{name}."}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts