Skip to content

Instantly share code, notes, and snippets.

@JonRowe
Created August 8, 2013 03:16
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 JonRowe/6181153 to your computer and use it in GitHub Desktop.
Save JonRowe/6181153 to your computer and use it in GitHub Desktop.
TIL, local variables are scoped / defined even if never executed.
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