webCOMAND

#CALC

Syntax

#CALC(Expression)

Parameters

Description

Process a Perl or PHP expression and output the returned result.

This statement produces output.

Related

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

Example

Here we will increase the month from December to February.

#ASSIGN($A,1)
#ASSIGN($B,2)
$A + $B = #CALC($A + $B)

Result

1 + 2 = 3

Analysis

In this example, variables $A and $B are assigned 1 and 2.  #CALC is used to interpret the equation and return the result: 3.  Unlike the #ASSIGN block, #CALC does not set a variable.