Skip to content

Instantly share code, notes, and snippets.

@sriram15690
Created March 27, 2016 10:30
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 sriram15690/de12792f2ab2ad7e790f to your computer and use it in GitHub Desktop.
Save sriram15690/de12792f2ab2ad7e790f to your computer and use it in GitHub Desktop.
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