Skip to content

Instantly share code, notes, and snippets.

@Sihui
Created April 27, 2017 05:53
Show Gist options
  • Save Sihui/b423fa590c65262d8fef0d5342fad895 to your computer and use it in GitHub Desktop.
Save Sihui/b423fa590c65262d8fef0d5342fad895 to your computer and use it in GitHub Desktop.
For [Code Block, Proc, Lambda, and Closure in Ruby]() Raw
# Only ->
# takes argument outside of {}
->(arg) { puts arg }
# The rest
# takes argument in between ||
{ |arg| puts arg }
proc do |arg|
puts arg
end
lambda { |arg| puts arg }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment