Skip to content

Instantly share code, notes, and snippets.

@ocher
Last active December 18, 2015 10:58
Show Gist options
  • Save ocher/5771903 to your computer and use it in GitHub Desktop.
Save ocher/5771903 to your computer and use it in GitHub Desktop.
class Puzzle
attr_accessor :field
def initialize
self.field = true
end
def run
puts field.inspect # => true
if false
field = "NEVER SET"
end
puts field.inspect # => ?
end
end
Puzzle.new.run
@ocher
Copy link
Author

ocher commented Jun 13, 2013

Hint:

1.8.7-p330 :001 > if false ; x = 5 ; end
 => nil 
1.8.7-p330 :002 > x
 => nil 
1.8.7-p330 :003 > y
NameError: undefined local variable or method `y' for #<Object:0x3794c>
    from (irb):3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment