Last active
December 24, 2015 06:09
-
-
Save djds4rce/6755530 to your computer and use it in GitHub Desktop.
Understanding functional
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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