--- title: "calculate and save variable()" slug: "basic-change-variable" updated: 2026-08-10T09:06:25Z published: 2026-08-10T09:06:25Z canonical: "docs.lobstersoftware.com/basic-change-variable" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # calculate and save variable() Performs a calculation on the value of variable **a** and saves the result back to the variable. If **d** is "true", the type of the variable will be checked and the Mapping will be finished with an error if the type is not numerical. In the case of a division, **e** specifies the number of digits the result should be rounded to. If nothing or "0" is specified, the result will be rounded to the number of the dividend's digits. The result of the function is the result of the calculation. ## Parameters | Parameter | Description | | --- | --- | | a | Variable name to read the value from and save to result to. | | b | Operation to perform. | | c | Second operand. | | d | "true" for type checking. | | e | Precision for the division. | The following operations are supported | Parameter b | Operation | | --- | --- | | + | Addition | | - | Subtraction | | * | Multiplication | | / | Division | ## Examples The examples are building on each other | Parameter a | Parameter b | Parameter c | Parameter d | Parameter e | Result | | --- | --- | --- | --- | --- | --- | | MYINTVAR | + | 3 | | | 3 | | MYINTVAR | * | 3 | | | 9 | | MYINTVAR | - | 2 | | | 7 | | MYINTVAR | / | 2 | | | 4 | | MYDECIMALVAR | + | 7 | | | 7 | | MYDECIMALVAR | / | 2 | | | 4 | | MYDECIMALVAR | / | 3 | | 2 | 1.33 | | MYSTRINGVAR | + | 7 | | | Function aborts with an error. | | MYSTRINGVAR | + | 7 | true | | Function aborts with an error. | | MYSTRINGVAR | + | 7 | false | | 7 | | MYSTRINGVAR | / | 2 | false | 1 | 3.5 | | MYSTRINGVAR | / | 2 | false | | 1.8 | The core task of Phase 3. Mapping transfers data from the source structure to the target structure according to defined rules. In the process, fields can be transformed, functions can be called, and values can be calculated.