deposit(amount), state: balance do new_state(balance + amount) end defcast deposit(amount), state: balance do if amount <= balance do new_state(balance – amount) else new_state(balance) end end defcall balance, state: balance do reply(balance) end end