title: Iterate and mutate an Array of Dictionaries Swift 3
body: <p>I am referencing this in the current Swift documentation:</p>
  
  <blockquote>
    <p>You can also iterate over a dictionary to access its key-value pairs. Each item in the dictionary is returned as a (key, value) tuple when the dictionary is iterated, and you can decompose the (key, value) tuple’s members as explicitly named constants for use within the body of the for-in loop. Here, the dictionary’s keys are decomposed into a constant called animalName, and the dictionary’s values are decomposed into a constant called legCount.</p>
    
    <p>let numberOfLegs = ["spider": 8, "ant": 6, "cat": 4]</p>
    
    <p>for (animalName,
    legCount) in numberOfLegs {</p>
  
  <pre><code>print("\(animalName)s have \(legCount) legs") } 
  </code></pre>
    
    <p>// ants have 6 legs // spiders have 8 legs // cats have 4 legs</p>
  </blockquote>
  
  <p>However, when I create an array of dictionaries dynamically, that code does not function:</p>
  
  <pre><code>let wordArray = ["Man","Child","Woman","Dog","Rat","Goose"]
  var arrayOfMutatingDictionaries = [[String:Int]]()
  
  var count = 0
  
  while count &lt; 6
  {
      arrayOfMutatingDictionaries.append([wordArray[count]:1])
      count += 1
  }
  </code></pre>
  
  <p>The above routine successfully creates the array of dictionaries, as it should, but when I try to iterate through it like the documentation shows:</p>
  
  <pre><code>for (wordText, wordCounter) in arrayOfMutatingDictionaries
  </code></pre>
  
  <p>I get an error: <strong>Expression type [[String:Int]] is ambiguous without more context</strong></p>
  
  <p>I do not understand that at all.</p>
  
  <p>The goal here is to have a mutable array of mutable dictionaries.  Over the course of the program, I want to add new Key-Value pairs, but also be able to increment the values if necessary.  I am not married to this collection type, but I thought it would work.</p>
  
  <p>Any ideas?</p>