Skip to content

Instantly share code, notes, and snippets.

@djds4rce
Last active December 24, 2015 06:09
Show Gist options
  • Save djds4rce/6755530 to your computer and use it in GitHub Desktop.
Save djds4rce/6755530 to your computer and use it in GitHub Desktop.
Understanding functional
variable_storing_a_function = Proc.new {|arg1,arg2| puts "First Argument : #{arg1}\nSecond Arguemt #{arg2}"}
variable_storing_a_function.call(1,2)
def an_example_function(variable1,variable2,&block)
sum = variable1+variable2
block.call(sum)
end
an_example_function(1,2){|sum| puts "Sum is:#{sum}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment