((r.calc.))
Calc Reacto helps us calculate simple arithmatics inside reactive text.
The structure of calc-reacto is very simple, viz. operand operator operand
. The operands can be numbers or any reacto that can be resolved to a number.
So, it is,
((r.calc. operand operator operand))
The available mathematic operators are,
+
-
*
/
+
# Direct Number Addition
((r.calc. 2 + 7)) // should give 9
# One operand a reacto
After 5 years: ((r.calc. r.dt.year + 5))
# Both operand reactos
((r.var.num1 = 9))\
((r.var.num2 = 3))\
((r.calc. r.var.num1 + r.var.num2)) // should give 12
-
# Direct Number Subtraction
((r.calc. 10 - 1)) // should give 9
# One operand a reacto
After 5 ago: ((r.calc. r.dt.year - 5))
# Both operand reactos
((r.var.num1 = 9))\
((r.var.num2 = 3))\
((r.calc. r.var.num1 - r.var.num2)) // should give 6
*
# Direct Number Multiplication
((r.calc. 2 * 7)) // Should give 14
# One operand a reacto
((r.calc. r.dt.year * 10))
# Both operand reactos
((r.var.num1 = 9))\
((r.var.num2 = 3))\
((r.calc. r.var.num1 * r.var.num2)) // should give 27
/
# Direct Number Division
((r.calc. 10 / 2)) // should give 5
# One operand a reacto
((r.calc. r.dt.year / 10))
# Both operand reactos
((r.var.num1 = 30))\
((r.var.num2 = 3))\
((r.calc. r.var.num1 / r.var.num2)) // should give 10