16. Set, create or change a value
Figure 12. Change Variable can add to a number, toggle a flag or set a live value from an expression.
| Node | Use |
|---|---|
| Set Variable | Assign one value. Set key_taken to Boolean true. |
| Create Variable | Add a runtime variable only if that name does not already exist. It does not reset an existing one. |
| Change Variable: set | Assign a JSON-capable value, including a resolved expression. |
| Change Variable: add / subtract | Increase or decrease a numeric value. |
| multiply / divide | Numeric arithmetic. A zero divisor leaves the existing value unchanged. |
| append | Append one value to an array; it is not text concatenation. |
| toggle | Invert the current truth value. |
1. Add Change Variable. Choose pulse_count.
2. Choose add under Operation.
3. Enter 1 in Value, without quotation marks. Commit the field.
4. Call the graph, then inspect pulse_count. A second call should add one again.
The special Set Variable editor follows the declared variable’s type. For an expression such as {"$param":"amount"}, use the JSON-capable Change Variable node with operation set or add instead of pasting that object into a Boolean dropdown.
