title: How to find same value(duplicate) in an int array in order?
body: <p>This is a basic slot game
  I am coding in swift, I have an int array of 7 numbers.</p>
  
  <p>The int array can have 1 to 7 values, and they are placed randomly.</p>
  
  <pre><code>   1&gt; [1, 2, 4, 7, 7, 7, 7]
     2&gt; [3, 3, 5, 7, 5, 3, 3]
     3&gt; [5, 5, 5, 2, 5, 1, 5]
     4&gt; [2, 2, 2, 2, 2, 2, 2]
  </code></pre>
  
  <p>Those are examples of what the array can have.</p>
  
  <blockquote>
    <p>In the 1st array you can see that there are 4 pairs of 7s.</p>
    
    <p>In the 3rd array the first 3 are another 3 pair 5s</p>
  </blockquote>
  
  <p>How do I go about doing this, this is what I have.</p>
  
  <pre><code>func processWin(val : Array&lt;Int&gt;){
  
          var counter = 0;
          var oldValue = 0;
  
          for num in val {
              if num == oldValue {
                  counter++;
              }
  
              oldValue = num;        
          }
  
          if counter == 3 {
              print("Three in a row!!!")
          }
  
          if counter == 4 {
              print("Four in a row!!!")
          }
  
          if counter == 5 {
              print("Five in a row!!!")
          }
          if counter == 6 {
              print("Six in a row!!!")
          }
          if counter == 7 {
              print("BOOM!")
          }
          print(counter)
      }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>If the array is [2, 2, 2, 2, 2, 2, 2] <strong>Print</strong> <code>BOOM</code></p>
  
  <p>If the array is [1, 2, 4, 7, 7, 7, 7] <strong>Print</strong> <code>Four in a Row</code></p>
  
  <p>If the array is [5, 5, 5, 2, 5, 1, 5] <strong>Print</strong> <code>Three in a Row</code></p>
  
  <p>If the array is [3, 3, 3, 2, 5, 5, 5] <strong>Print</strong> <code>Three in a Row</code> &amp; <code>Three in a Row</code></p>
  
  <p>If the array is [7, 7, 7, 7, 5, 5, 5] <strong>Print</strong> <code>Four in a Row</code> &amp; <code>Three in a Row</code></p>