title: ruby about attr_accessor, instance variables, local varibles
body: <p>I'm so confused about that..
  like this</p>
  
  <pre><code>class Box 
     attr_accessor :item ,:item2  
  
     def initialize(item2)
        @item = []
        @item2 = item2
     end
  
     def add(product)
        item &lt;&lt; product
     end
  
     def empty?
        item.empty?
     end
  
     def increment(n=1)
        item2 +=1
     end
  
  end
  
  cart =Box.new(123)
  cart.add(1)
  puts cart.empty? #false
  puts cart.item   #1
  </code></pre>
  
  <p>in the 'add' and 'empty?' methods
  I use local variable 'item' right?
  why I can get the value from @items ??</p>
  
  <p>and I try this </p>
  
  <pre><code>cart.item2 = 345
  puts cart.item2  #345
  puts cart.increment #'increment': undefined method `+' for nil:NilClass (NoMethodError)
  </code></pre>
  
  <p>now I can't get the value?</p>
  
  <p>please fix my brain thx</p>