Skip to content

Instantly share code, notes, and snippets.

@jpablobr
Forked from jimweirich/return_scope.rb
Created August 26, 2010 00:56
Show Gist options
  • Save jpablobr/550590 to your computer and use it in GitHub Desktop.
Save jpablobr/550590 to your computer and use it in GitHub Desktop.
# What's the output of this program?
# Compare Ruby 1.8 to 1.9.
def fl; lambda { return 1 }.call; 2; end
def fp; proc { return 1 }.call; 2; end
def fPn; Proc.new { return 1 }.call; 2; end
puts fl
puts fp
puts fPn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment