ludic/examples/modules/bank/ledger.ludic
Orkuncakilkaya 19fcf60599 wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
  1804 vars into 126 states, 64 into lets; 23498 edits in 460 files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 15:31:34 +03:00

15 lines
434 B
Text

# bank/ledger.ludic - inherits `module bank` from the barrel that imports it
export state BankState {
balance: int = 0
}
export event Deposited { amount: int }
function add(bank_st: mut BankState, n: int) -> void {
bank_st.balance += n
}
export function deposit(bank_st: mut BankState, n: int) -> void {
add(bank_st, n)
emit Deposited(amount: n)
}
export function total(bank_st: BankState) -> int {
return bank_st.balance
}