ExamplesCounter

Examples: Counter

Woven from its 114 bytes

Counter

A number kept in the script’s storage, one higher every run.

Language
JavaScript
Bytecode
114bytes
Cards
13
Units on the Weft VM
21 336CU
Runs
Inline, in one transaction
// Every run reads the count, adds one, and writes it back.
let n = load("count") ?? 0
n += 1
store("count", n)
log("run", n, "at slot", slot())
return n