Created
July 30, 2012 02:48
-
-
Save ihower/3203697 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo | |
111 | |
rescue | |
222 | |
ensure | |
333 | |
end | |
puts foo # got 111, why???? | |
def bar | |
111 | |
rescue | |
222 | |
ensure | |
return 333 | |
end | |
puts bar # got 333 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Write in
The Ruby Programming Language
#163Note that ensure clause does not alter the return value of a method unless it explicitly uses a return statement