Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 478
TonyGW Avatar asked May 17 '14 23:05

TonyGW


1 Answers

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>.

like image 83
ddekany Avatar answered Sep 26 '22 03:09

ddekany