Plus Operator

The plus operator (+) performs numeric addition, resulting in a numeric value. Attempting to concatenate string expressions will cause an exception.

The result will be a float numeric if at least one of the values used is a float; otherwise the result will be an integer.

The following example shows a float result:

$script.subtotal = 14

$script.taxes = 2.32

$script.total = $script.subtotal + $script.taxes

The value stored in the Script object variable total would be the float value, 16.32

Using 0.0 in a numeric addition will force the result to a float value.

The following example shows an integer result:

$script.acknowledgedTotal = 0

$script.hasAcknowledged = true

$script.acknowledgedTotal = $script.acknowledgedTotal + \

$script.hasAcknowledged

The value stored in the Script object variable acknowledgedTotal would be the integer value, 1.

Note that in accordance with the auto-conversion rules, the Boolean variable hasAcknowledged was converted to a value of 1 (and not 1.0) because no other float values are present in the expression.