Skip to content

Instantly share code, notes, and snippets.

@headius
Last active December 29, 2015 11:39
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 headius/7665198 to your computer and use it in GitHub Desktop.
Save headius/7665198 to your computer and use it in GitHub Desktop.
New behavior of return in blockified (using &) lambda in Ruby 2.1.
system ~/projects/ruby $ ruby2.1 -e "def foo; bar &->{return}; puts :a; end; def bar; yield; puts :b; end; foo; puts :c"
b
a
c
system ~/projects/ruby $ ruby2.0.0 -e "def foo; bar &->{return}; puts :a; end; def bar; yield; puts :b; end; foo; puts :c"
c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment