playframework - How to declare and access local variables in scala template in play framework? -
i have code in scala template like:
@for(col <- list.range(0,12)) { <td> @if(col % 2 == 0) { @{ val letter = somemap(col) } <div class="z@(letter)@(letter)s"></div> } </td> } but compile error: value letter not found. how can declare variables , able access later in markup above?
actually have never seen @if nor have tried playframework. if think is, seems when try ask letter it's out of scope. happens if re-arrange brackets follows?
@for(col <- list.range(0,12)) { <td> @if(col % 2 == 0) { @{val letter = somemap(col) <div class="z@(letter)@(letter)s"></div> } } </td> }
Comments
Post a Comment