title: How to populate an array using gets.chomp
body: <p>Here's what I have so far:</p>
  
  <pre><code>#Table of Contents using an array
  title = "Table of Consents"
  
  #Needs chapters inputted
  chapters = Array.new
  
  puts "Please input chapter names."
  
  while gets.chomp != ""
    chapter = gets.chomp
    chapters.push chapter
    break if gets.chomp.empty?
  end
  
  #Needs corresponding page numbers inputted
  pagenumbers = Array.new
  
  puts "Please input corresponding page numbers."
  
  while gets.chomp != ""
    pagenum = gets.chomp
    pagenumbers.push pagenum
    break if gets.chomp.empty?        
  end
  
  puts chapters
  puts page numbers
  </code></pre>
  
  <p>I'm trying to get <code>gets.chomp</code> to continue adding to each array. When I push <code>chapter</code> or <code>pagenum</code>, I only get the last string/integer input. How do I get each input to populate the <code>chapter</code> or <code>pagenum</code> array?</p>