Question: In this code I want to increment `index` to put it to each `yield`ing result.

```
var index=0

for(str <- splitToStrings(text) ) yield  {

  if (index != 0) index += 1               // but index is equal to `0` all the time

  new Word(str, UNKNOWN_FORM, index )
}

```

Why I can not change `index` ? And what the best way to implement this logic then, trying to be concise?

Answer: 
The `zipWithIndex` method on most sequence-like collections will give you a zero-based index, incrementing with each element:

```
for ((str, index) <- splitToStrings(text).zipWithIndex)
  yield new Word(str, UNKNOWN_FORM, index)

```
Because initially index is set to 0, thus your condition `index != 0` is never executes to true and index is never got incremented. ~~Maybe you don't need this condition? Maybe you can count results afterwards?~~ Now I see that index is used within loop. Then you have to either use [@BenJames answer](https://stackoverflow.com/a/16883955/298389) or go recursive.