Skip to content

Instantly share code, notes, and snippets.

@DanielVartanov
Created July 14, 2012 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielVartanov/3109708 to your computer and use it in GitHub Desktop.
Save DanielVartanov/3109708 to your computer and use it in GitHub Desktop.
def create_proc(cofactor)
proc = proc { |arg| arg * cofactor }
end
proc1 = create_proc(3)
proc2 = create_proc(5)
proc1.call(2)
=> 6
proc2.call(2)
=> 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment