webCOMAND

#CALC

Process a cTemplate expression or cScript expression and output the returned result.

Prototype

#CALC(expression)

Parameters

Example

#/ cScript - Output: 1 + 2 = 3
#ASSIGN($a,1)
#ASSIGN($b,2)
$a + $b = #CALC($a + $b)

#/ cTemplate - Output: Hello World!
#CALC("#NEW($var)Hello#ENDNEW$var World!")

#/ cTemplate and cScript - Output: Count = 3
#ASSIGN($array, [1, 2, 3])
#CALC("#NEW($var)Count#ENDNEW$var = " + count($array))

Related

#ASSIGN is similar to #CALC, except instead of outputting the result, it sets a variable to the result.