I have a simple code in scala template for Play
@( val i = 0){
.......
....
i => i+1; // incremental
}
But the above code is not working any idea how to fix this ?
You can fetch the index of the iteration in Scala for
loop, just zipWithIndex
your collection:
@for((day, index) <- model.days.zipWithIndex) {
<li>Day @index is @day</li>
}