-
-
Notifications
You must be signed in to change notification settings - Fork 117
Open
Labels
Description
Today I tried to make use of a scala.Option in my twirl template but found it rather hard / unelegant to use it in a nice way.
what I had to do was
@if(myOption.isDefined) {
some code @myOption.get
} else {
some alternative code
}
What I wanted was something like a map with an else block, basically this kind of code
@if(myOption) { value =>
code when my value is @value
} else {
code when my value is not present
}
Is there something like this already? If not, how would I get started in providing a PR?
Is it a good idea to enhance the "if" with this or should I focus on implementing a new thing like @ifdefined(myOption) { value => ... } else { .. } ?