Created
August 8, 2013 03:16
-
-
Save JonRowe/6181153 to your computer and use it in GitHub Desktop.
TIL, local variables are scoped / defined even if never executed.
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 test | |
begin | |
raise | |
local = 'b' | |
rescue | |
ensure | |
return defined?(local) || false | |
end | |
end | |
puts test # => local-variable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment