Mega Code Archive

 
Categories / Ruby / Method
 

How do you reach the code in the block from inside the method

# You use the yield statement, which is designed for exactly that purpose.  def greeting()   yield end greeting {puts "Hello there!"}