EXAMPLE 04 OF 8 · Starter
Keep a balance between runs
Practice saving a wallet balance so the next run can compare it with a new observation.
Before you begin
- Use the same workflow copy and Browser runtime for both runs. No wallet or RPC connection is needed for these editable practice balances.
Walk through the workflow
- Initialize State creates lastBalance with an empty value only if the key is missing.
- Observation keeps the previous State value and a sample current balance on this path.
- Update State saves the current balance. Result shows the earlier snapshot beside the latest State value.
- Run once with currentBalance set to 2. Change it to 1.8 and run again: previousBalance is 2 and savedBalance is 1.8.
Compare two runs
The first run starts with previousBalance empty and saves 2. Change currentBalance in Observation to 1.8 and run again. Initialize State preserves the saved 2; Update State replaces it with 1.8. Result shows both values. A Variable keeps the earlier observation on this path, while State remembers the balance for the next run.
These balances are editable practice inputs. The behavior is the same for a scheduled run.
Start over
Delete lastBalance with Delete State before initialization to start empty again. Changing Initial value alone does not reset an existing key.
Where the value lives
Use the same workflow copy and runtime for both runs. Importing another copy or changing runtimes gives you separate State; exporting a workflow does not carry stored values.