Skip to content

Instantly share code, notes, and snippets.

@chrisle
Created June 13, 2013 14:38
Show Gist options
  • Save chrisle/5774203 to your computer and use it in GitHub Desktop.
Save chrisle/5774203 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 # => ? << ** this is TRUE
end
end
what_is_run = Puzzle.new.run
puts what_is_run # => nil
#######################
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
field # ADDED
end
end
what_is_run = Puzzle.new.run
puts what_is_run # => TRUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment