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
Paramter 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 |