counter
zsx / 7guis
program
fun main() { mut count: int = 0; imu counter: </> ::= <> <input type="number" value={count}> <button onclick={fn() => count += 1}>count</button> </>; #render counter; }
This program declares a component (counter) composed by a textfield (<input> eq T) and a button (<button> eq B). Initialy, it declares the value of T (count) to 0. Then the counter is rendered via a directive (#render). Each time, B is clicked, it triggers and executes and event (@click) to increase the value of T.
source — 7GUIs (Counter)