TonyW
TonyW

Reputation: 18875

FreeMarker Template: how to use combined conditions in <#if> </#if> block?

I am wondering how to assess two conditions in an <#if> statement in FreeMarker Template ? for example, in pseudo code:

if (i < 10 && i > 2)
    do something;

how to use two conditions in Freemarker? thanks

Upvotes: 9

Views: 21576

Answers (1)

ddekany
ddekany

Reputation: 31112

The tricky part in that expression is that the > operator ends the FTL tag. To work that around, you can write <#if i < 10 && (i > 2)> or <#if i < 10 && 2 < i> or <#if i < 10 && i &gt; 2>.

Upvotes: 26

Related Questions