title: How can I modify positions in a two dimensional array?
body: <p>If I do the following:</p>
  
  <pre><code>table = Array.new(
    3,
    Array.new(
      3,
      nil
    )
  )
  
  # =&gt;
    [
      [nil, nil, nil], 
      [nil, nil, nil], 
      [nil, nil, nil]
    ]
  </code></pre>
  
  <p>Now I would like to modify the value at index 2 in the second array, so I would do:</p>
  
  <pre><code>table[1][2] = 2.343
  </code></pre>
  
  <p>I would now expect to see: </p>
  
  <pre><code># =&gt;
    [
      [nil, nil, nil], 
      [nil, nil, 2.343], 
      [nil, nil, nil]
    ]
  </code></pre>
  
  <p>However what I'm getting is this:</p>
  
  <pre><code>[
    [nil, nil, 2.343], 
    [nil, nil, 2.343], 
    [nil, nil, 2.343]
  ]
  </code></pre>
  
  <p>What am I not getting here?</p>
  
  <p>PS: Running ruby 2.3</p>