score:7

Accepted answer

Actually I have never seen @if nor have I tried PlayFramework. But if is what I think it is, it seems that when you actually try to ask for letter it's already out of scope. What happens if you re-arrange the brackets as follows?

@for(col <- List.range(0,12)) {
  <td>
    @if(col % 2 == 0) {
      @{val letter = someMap(col)
        <div class="z@(letter)@(letter)s"></div>
      }
    }
  </td>
}

score:0

The only way I got this working on Play Framework 2.8.x was with Scala's Range function:

@import scala.collection.immutable.Range

@for(col <- Range(0,12)) {
  <td>
    @if(col % 2 == 0) {
      @{val letter = someMap(col)
        <div class="z@(letter)@(letter)s"></div>
      }
    }
  </td>
}

Related Query

More Query from same tag