Skip to content

Instantly share code, notes, and snippets.

@bitops
Created January 10, 2012 03:15
Show Gist options
  • Save bitops/1586656 to your computer and use it in GitHub Desktop.
Save bitops/1586656 to your computer and use it in GitHub Desktop.
optional params and blocks
def f(x, y=nil, &block)
puts x
puts y
block.call
end
f(1) { puts "inside block" }
f(1, 2) { puts "inside block" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment