I have the following code in a Play 2.0 template:
@content.toString.lines.map{ case line => // i put `case` here as another attempt to make it work line match { case "" => @Html("") case _ => <li>@Html(line)</li> /*CRASH*/ } }
It does not work on the marked line, saying that not found: value line
. The second option:
@for(line <- content.toString.lines){ @line match { /*CRASH*/ case "" => @Html("") case _ => <li>@Html(line)</li> } }
doesn't work on the marked line, claiming that 'case' expected but identifier found
.
UPDATE:
The same goes for val
:
@val headID = "head"
illegal start of simple expression
appears.
UPDATE ENDS
I would like to know what I am doing wrong and how to correctly implement the match-case
and val
structure in play patterns?
source share