Getting scala's template loop index in playframework -


i trying iterate in playframework view, without success now. have following structure:

@if(list != null) {     for(a <- 0 list.size()/5)     {        //  html, want value of        for(b <- a*5 a*5+5)  // here want use value again        {             html        }     } 

so question how current index of loop able use it.

you should combine in 1 loop:

@if(list != null) {     @for{a <- 0 list.size()/5         b <- a*5 a*5+5}             yield html     } } 

and use option instead of null checking. can use map function transform list. see details in play documentation - http://www.playframework.com/documentation/2.0/scalatemplates


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -