o = Object.new o.instance_variable_set(:@x, 0) # Note required @ prefix o.instance_variable_get(:@x) # => 0 o.instance_variable_defined?(:@x) # => true