Skip to content

Instantly share code, notes, and snippets.

@romanblanco
Last active October 24, 2021 18:26
Show Gist options
  • Save romanblanco/85f439022da033466ec0d7ea934b62ed to your computer and use it in GitHub Desktop.
Save romanblanco/85f439022da033466ec0d7ea934b62ed to your computer and use it in GitHub Desktop.
def func(string1, string2, block)
string = string1 + " " + string2
puts "\#1: #{string}"
block.call(string, 'here')
end
# => :func
proc = Proc.new { |a, b| puts "\#2: #{a}, #{b}" }
func "calling", "function", proc
# #1: calling function
# #2: calling function, here
# => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment