title: How to iterate over an array of objects Ruby
body: <p>I created a class and added objects like so:</p>
  
  <pre><code>class Tops
    def initialize(neckline, brand, maincolour, style)
      @neckline = neckline
      @brand = brand
      @maincolour = maincolour
      @style = style
    end
  end
  
  top1 = Tops.new("Sweetheart", "Miss Selfridge", "Blue", "Bardot")
  top2 = Tops.new("Scoop", "Target", "Pink", "Vest")
  top3 = Tops.new("Boat", "Unknown", "Red", "Tank")
  </code></pre>
  
  <p>I then used the <code>push</code> method to add some of these objects into an empty array.</p>
  
  <pre><code>currentTopChoices = []
  currentTopChoices.push(top1,top3)
  </code></pre>
  
  <p>I then used some the <code>each</code> method to run a block of code or each object in this array</p>
  
  <pre><code>currentTopChoices.each { |x| puts @neckline }
  </code></pre>
  
  <p>So my aim was really to get an output of each neckline of the objects in the array but I get an output of:</p>
  
  <pre><code>Boat
  Boat
  </code></pre>
  
  <p>When I really wanted:</p>
  
  <pre><code>Sweetheart
  Boat
  </code></pre>
  
  <p>Which is really the neckline of the last object but printed twice. I get no error messages so what exactly am I missing here?</p>