How do I declare and increment a variable in play2? (in .scala.html templates)
Pseudo code:
@counter
@for(l <- list){
<span class="data-@counter">
</span>
@(counter += 1)
}
How do I declare and increment a variable in play2? (in .scala.html templates)
Pseudo code:
@counter
@for(l <- list){
<span class="data-@counter">
</span>
@(counter += 1)
}
to declare at template
for increment in template
Do you really need counter and incrementing? You can do this:
Method
zipWithIndex
creates list of tuples.