In their most basic form, FormCalc expressions are groups of operators, keywords, and literals strung together in logical ways. For example, these are all simple expressions:
2
“abc”
2 – 3 * 10 / 2 + 7
Each FormCalc expression resolves to a single value by following a traditional order of operations, even if that order is not always obvious from the expression syntax. For example, the following sets of expressions, when applied to objects on a form design, produce equivalent results:
1 (true)
0 (false)
As the previous table suggests, all FormCalc operators carry a certain precedence when they appear within expressions. The following table illustrates this operator hierarchy:
=
In cases where one or more of the operands within a given operation do not match the expected type for that operation, FormCalc promotes the operands to match the required type. How this promotion occurs depends on the type of operand required by the operation.
When performing numeric operations involving non-numeric operands, the non-numeric operands are first promoted to their numeric equivalent. If the non-numeric operand does not successfully convert to a numeric value, its value is 0. When promoting null-valued operands to numbers, their value is always zero.
1
8
When performing Boolean operations on non-Boolean operands, the non-Boolean operands are first promoted to their Boolean equivalent. If the non-Boolean operand does not successfully convert to a nonzero value, its value is true (1); otherwise its value is false (0). When promoting null-valued operands to a Boolean value, that value is always false (0). For example, the expression:
“abc” | 2
evaluates to 1. That is, false | true = true, whereas
if (“abc”) then
10
else
20
endif
When performing string operations on nonstring operands, the nonstring operands are first promoted to strings by using their value as a string. When promoting null-valued operands to strings, their value is always the empty string. For example, the expression:
concat(“The total is “, 2, ” dollars and “, 57, ” cents.”)
evaluates to “The total is 2 dollars and 57 cents.”
Note:
If during the evaluation of an expression an intermediate step yields NaN, +Inf, or -Inf, FormCalc generates an error exception and propagates that error for the remainder of the expression. As such, the expression’s value will always be 0. For example:
3 / 0 + 1

Simple