MCPcopy Create free account
hub / github.com/derekbanas/Go-Tutorial / Withdraw

Method Withdraw

hellogo.go:256–266  ·  view source on GitHub ↗
(v int)

Source from the content-addressed store, hash-verified

254}
255
256func (a *Account) Withdraw(v int) {
257 a.lock.Lock()
258 defer a.lock.Unlock()
259 if v > a.balance {
260 pl("Not enough money in account")
261 } else {
262 fmt.Printf("%d withdrawn : Balance : %d\n",
263 v, a.balance)
264 a.balance -= v
265 }
266}
267
268// ----- CLOSURES -----
269// Pass a function to a function

Callers 1

mainFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected