How to get index for "for loop" in scala template?

3,474 views
Skip to first unread message

Roman Bykovskiy

unread,
Mar 14, 2012, 10:01:19 AM3/14/12
to play-fr...@googlegroups.com
How can I get index for "for loop" in scala template?
Can't even reassign value to varable to make independed counter (
Not enough documentation on this!

Julien Richard-Foy

unread,
Mar 14, 2012, 11:07:41 AM3/14/12
to play-fr...@googlegroups.com

Leonard Punt

unread,
Mar 14, 2012, 11:09:34 AM3/14/12
to play-fr...@googlegroups.com
I assume this is a Play2.0 question, isn't it?

I think this is what you need:

@for(for(i <- 0 to list.size-1) {
    @list(i)
}

or simply:

@for(i <- list.indices) {

  @list(i)
}

Reply all
Reply to author
Forward
0 new messages