title: Write a kotlin program that prints the number that is repeated the most in a consecutive way
body: <p>I'm kind of stuck, I don't know how to make the second loop to start 1 position above the first loop in Kotlin.</p>
  <p>I have an array (named myArray) with 10 elements, I need to Write a Kotlin program that prints the number that has the most consecutive repeated number in the array and also prints the number of times it appears in the sequence.
  The program must parse the array from left to right so that if two numbers meet the condition, the one that appears first from left to right will be printed.</p>
  <p>Longest: 3<br />
  Number: 8</p>
  <pre><code>fun main() {
      val myArray: IntArray = intArrayOf(1,2,2,4,5,6,7,8,8,8)    
      
      for((index , value) in myArray.withIndex()){   
          
          var inx = index + 1
          var count = 0
          var longest = 0
          var number = 0
          
          for((inx,element) in myArray.withIndex()) {
              
              if(value == element ){
                  count+=
              }
          }   
          if(longest &lt; count){
              longest = count
              number = value
          }    
     }
  }
  </code></pre>