MCPcopy Create free account
hub / github.com/bitfield/ftl-code / Withdraw

Function Withdraw

withdraw/withdraw.go:5–11  ·  view source on GitHub ↗
(balance, amount int)

Source from the content-addressed store, hash-verified

3import "errors"
4
5func Withdraw(balance, amount int) (newBalance int, err error) {
6 newBalance = balance - amount
7 if newBalance < 0 {
8 return 0, errors.New("overdrawn")
9 }
10 return newBalance, nil
11}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected