eval

Evaluates the contents of a string as an expression.

Syntax

eval(str_expr)

Argument

str_expr
A string expression.

Example

Templex Expression Result
{formula = "1 + 1"}

{eval(formula)}

2
{eval("sin(PI/2)")} 1

Comments

When Templex encounters an eval statement, str_expr is evaluated as an expression and the result is written to the output text. The contents of str_expr are not changed.

str_expr can be either a literal text string or a string variable. If str_expr is a literal text string, it must be placed between double quotes.