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:
Class | Associative property | Operators |
Group | Inserted | (expression) |
Unary | From right to left | ! + - |
Multiplicative | From right to left | * / mod div |
Additive | From right to left | + - |
Relations | From right to left | < <= > >= lt le gt ge |
Equals | From right to left | == != eq ne |
Logical AND | From right to left | && and |
Logical OR | From 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