title: Incrementing Variable in a foldLeft
body: <p>I have Scala code like this</p>
  
  <pre class="lang-scala prettyprint-override"><code>var i = 1
  for(e &lt;- array) {
      acc += e * i
      i += 1
  }
  </code></pre>
  
  <p>I need to multiply the first element in the array by 1, the next by 2, the next by 3 and so on adding it all into an accumulator. I feel that there is a better way of doing this in Scala, maybe even with folding?</p>