Arithmetical and logical expressions


Beginning from the version 2.1.0 templator are support the arithmetical and logical expressions.
The priority of operators and accociative property they are given in the table:

ClassAssociative propertyOperators
GroupInserted(expression)
UnaryFrom right to left!  +  -
MultiplicativeFrom right to left*  /  mod  div
AdditiveFrom right to left+  -
RelationsFrom right to left<  <=  >  >=  lt  le  gt  ge
EqualsFrom right to left==  !=  eq  ne
Logical ANDFrom right to left&&  and
Logical ORFrom right to left||  or
Example:
[
    a : 2,
    b : 3
]
<TMPL_var (a + b)>
5

<TMPL_if (a < b)>OK</TMPL_if>
OK

<TMPL_if (b mod a == 1)>OK</TMPL_if>
OK


Copyright © 2003 - 2010 CTPP Dev. Team | http://ctpp.havoc.ru