Reputation: 19
I want to define this Java variable
int x = 0;
x = x + 1;
How is it in Play Scala Template??
I already tried this for defining:
@import scala.Predef;
val x= 0
but I can't add the variable
Upvotes: 0
Views: 2282
Reputation: 3206
They should be on the same line
@import scala.Predef; val x= 0
Also, if it is a variable, you should use var
not val
.
So what you need is
@import scala.Predef; var x= 0
And for reassigning:
@(x = x + 1)
Upvotes: 1