Skip to content

Instantly share code, notes, and snippets.

@MikeSilvis
Created October 31, 2012 17:44
Show Gist options
  • Save MikeSilvis/3988606 to your computer and use it in GitHub Desktop.
Save MikeSilvis/3988606 to your computer and use it in GitHub Desktop.
def pass_my_block(&block)
puts "Hi Paul!"
yield
puts "Bye Paul!"
end
pass_my_block do
puts "You smell"
end
=>
HI Paul!
You smell
Bye Paul!
@pws5068
Copy link

pws5068 commented Oct 31, 2012

function pass_my_block($block) {
echo("Hi Mike");
$block();
echo("Bye mike");
}

$block = function() { echo("you smell"); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment