2
votes

I am trying to learn play framework, while practicing sample code I am getting an error: "illegal start of simple expression"

     @main("TODO list")
4{
5   <h1>@tasks.size() task(s)</h1>
6   <ul>
7       @for(task <- tasks) 

Error is shown in line 7, I have no idea why it is

1
Maybe you forgot the '{': @for(task <- tasks){ - ndeverge
Show us whole template please (not only error message). - biesior
@nico_ekito - you are right, the problem is with "{", earlier it was in newline,now I kept it in same line like "@for(task <- tasks){" and it is working. Thanks. - Nishikant
why having braces in next line create compiler error? - Nishikant

1 Answers

4
votes

You forgot the '{' character at the following line:

@for(task <- tasks){

It is needed on the same line by the Scala template engine to ensure that the '{' comes from the templating language, and that it is not a HTML character.