Skip to content

Instantly share code, notes, and snippets.

@kmdsbng
Created January 21, 2015 01:50
Show Gist options
  • Select an option

  • Save kmdsbng/3bb3405c080483c68b88 to your computer and use it in GitHub Desktop.

Select an option

Save kmdsbng/3bb3405c080483c68b88 to your computer and use it in GitHub Desktop.
a = 1.tap {|i| puts i + i}
a # => 1
b = 1.tap {|i| break i + i}
b # => 2
# >> 2
#lam = lambda {|i| return 1}
def use_proc
pro = proc {|i|
return i + 1
}
result = pro.call(1)
return result + 3
end
use_proc # => 2
def use_lambda
lam = lambda {|i|
return i + 1
}
result = lam.call(1)
return result + 3
end
use_lambda # => 5
# >> 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment