title: Swift: Terminated by Signal 4
body: <p>I'm trying to write a function that has arrayOne, arrayTwo, and arrayThree as inputs. If arrayTwo has any 0s as its last elements, the function is supposed to remove these elements from the array, as well as the same elements from arrayOne. When I run the code and try to test it, I get the error: "Terminated by signal 4". </p>
  
  <p>What could the problem be?</p>
  
  <pre><code>var arrayOneNew = arrayOne
  var arrayTwoNew = arrayTwo
  var arrayThreeNew = arrayThree
  
   var endElement = arrayTwoNew.last
   if endElement == 0 {
      var counter = arrayTwoNew.count
      while arrayTwoNew[counter] == 0 {
          var elementToBeRemoved = arrayTwoNew.remove(at: counter - 1) 
          var 2ndElementToBeRemoved = arrayOneNew.remove(at: counter - 1)
      }
          } 
  </code></pre>