Skip to content

Instantly share code, notes, and snippets.

@liaden
Created September 25, 2015 22:10
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 liaden/b890955192e55c478f3a to your computer and use it in GitHub Desktop.
Save liaden/b890955192e55c478f3a to your computer and use it in GitHub Desktop.
The existence of an unevaluated local changes things
class X
attr_accessor :x
def f
self.x = 2
if false
# try commenting out x=0 to see what happens.
x = 0
end
puts x.inspect
end
end
X.new.f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment