title: Convert Java loop to Scala
body: <p>I'm attempting to convert a Selection sort from Java to Scala and im unsure how to convert this loop to Scala : </p>
  
  <pre><code>for (int j = i + 1; j &lt; N; j++)
  </code></pre>
  
  <p>Here is a larger Java code sample and its Scala equivalent : </p>
  
  <p>Java : </p>
  
  <pre><code>sort(Comparable[] a)
  {
  int N = a.length;
  for (int i = 0; i &lt; N; i++)
  {
     int min = i
     for (int j = i + 1; j &lt; N; j++)
  }
  </code></pre>
  
  <p>Scala : </p>
  
  <pre><code>  def sort(a : Array[Ordered[Any]]) = {
      var N = a.length
  
      for (i &lt;- 0 until N) {
          var min = i
  
          for(j &lt;- until j &lt; N){
  
          }
      }
  
    }
  </code></pre>
  
  <p>How do I convert the inner loop to Scala ?</p>
  
  <pre><code>for (int j = i + 1; j &lt; N; j++)
  </code></pre>
  
  <p>I dont know how to do assignment while iterating...</p>