You're thinking imperatively rather than functionally. If you wanted to apply a function to each element in an array within Scala, then the idiomatic way of doing it is to utilise the map function, so that you have something like:
val elements = Array(1,2,3,4,5)
val results = elements map { x => x+4}
If you need to utilise the index of each element in your function call, then transform the array into an array (or sequence) of pairs using zip with index like this:
scala> elements.zipWithIndex
res0: Array[(Int, Int)] = Array((1,0), (2,1), (3,2), (4,3), (5,4), (6,5))
Then you can apply a map again, this time applying a function which takes a pair rather than a single element:
scala> elements.zipWithIndex map { case (x,y) => (x, y*5) }
res2: Array[(Int, Int)] = Array((1,0), (2,5), (3,10), (4,15), (5,20), (6,25))
or
scala> elements.zipWithIndex map { case (x, y) => x*y }
res3: Array[Int] = Array(0, 2, 6, 12, 20, 30)
If you want to apply a different function per index, then just supply a different definition within the map closure:
scala> elements.zipWithIndex map {
case (0, y) => y + 45
| case (1, y) => y + 5
| case (_, y) => y
| }