Skip to content

Instantly share code, notes, and snippets.

@leucos
Created March 29, 2012 07:27
Show Gist options
  • Select an option

  • Save leucos/2234525 to your computer and use it in GitHub Desktop.

Select an option

Save leucos/2234525 to your computer and use it in GitHub Desktop.
Yield a block
def nyan(&block)
yield
end
nyan do
printf "Nyan"
end
def nyan(&block)
puts "\nPrenyan stage"
10.times {yield}
puts "\nPostnyan stage"
end
nyan do
printf "Nyan"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment