Created
March 27, 2016 10:30
-
-
Save sriram15690/de12792f2ab2ad7e790f to your computer and use it in GitHub Desktop.
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
def lambda_test(x) | |
lam = lambda { |x| puts "Square is #{x * x}"; return; puts "cube is #{x*x*x}" } | |
lam.call x | |
puts "Hello World in Lambda" | |
end | |
def proc_test(x) | |
proc = Proc.new do |x| | |
puts "Square is #{x * x}" | |
return | |
puts "cube is #{x*x*x}" | |
end | |
proc.call(x) | |
puts "Hello Word in Proc" | |
end | |
lambda_test(4) | |
proc_test(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment