Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logical operators in Closure Templates

I'm playing with Google Closure Templates and I'm unable to successfully compile some templates because it seems that the logical "and" and "or" operators can't be used inside the if tag (I tried both "&&" and "and" and "||" and "or")... how can I write a "complex" if statements like: {if condition1 && condition2} ?

EDIT:

The following simple statement raises an exception:

{if 5 > 2 && 2 == 2}

"Not all code is in Soy V2 syntax (found tag {if 5 > 2 && 2 == 2} not in Soy V2 syntax)"

like image 423
daveoncode Avatar asked Jul 09 '12 13:07

daveoncode


1 Answers

According to the latest version of the docs, use can use and and or as logical operators:

{if $x > 1 and $y < 1}
   ...
{elseif $x < 1 or $y > 2}
   ...
{/if}
like image 169
daveoncode Avatar answered Oct 15 '22 23:10

daveoncode