title: How to determine if an array has consecutive integers and if so, how many?
body: <p>I am still pretty new at Scala, but I am trying to determine if an array has any consecutive integers, and if it does then how many does it have. Here is what I have so far, but I haven't got it working yet.</p>
  
  <pre><code>def isConsecutive(seq: Array[Int]): (Boolean, Int) = {
      var arr: Array[Int] = Array[Int]()
      for((v, i) &lt;- seq.zipWithIndex) {
        if (i &lt; seq.length()) {
          if (v + 1 == seq(i + 1)) {
            arr = arr :+ v
          }
        }
      }
      var res = if (arr.length() &lt; 1) true else false
      return (res, arr.length())
    }
  </code></pre>
  
  <p>I just want to return a Boolean for whether or not the array has consecutive integers, i.e. 1,2,3, and the number of consecutive integers or zero.</p>