title: Ruby array delete vs delete(bang)
body: <p>I thought Array#delete deleted all copies of an object in an array, but some weird (and inexplicable to me) things are happening in this program I am writing.  Delete only seems to work when I include a bang at the end of the delete function, even though that doesn't seem to be defined.</p>
  
  <p>Here is the function in question:</p>
  
  <pre><code>  def propagate
      @puzzle.each do |sqr, values|
        if values.length == 1
          @neighbors[sqr].each do |neighbor|
            @puzzle[neighbor].delete!(values)
          end 
        end 
      end 
    end 
  </code></pre>
  
  <p>@puzzle is a hash with strings as keys and values, formatted like so: <code>@puzzle["A1"] = "123456789"</code></p>
  
  <p>@neighbors is a hash with strings as keys and arrays of strings as values:</p>
  
  <pre><code>@neighbors["A1"] = ["A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "B1", "C1", "D1", "E1", "F1", "G1", "H1", "I1", "B2", "B3", "C2", "C3"]
  </code></pre>
  
  <p>when I run the code like this:  <code>@puzzle[neighbor].delete(values)</code></p>
  
  <p>The values in puzzle are unaffected by the delete.  But when I include the ! it works.</p>
  
  <p>Why is this?</p>