Mega Code Archive

 
Categories / Ruby / Method
 

After yield executes, control comes back to the next statement immediately following yield

def gimme   if block_given?     yield   else     puts "Oops. No block."   end   puts "You're welcome." # executes right after yield end gimme { print "Thank you. " } # => Thank you. You're welcome.