bank

package
v0.0.0-...-6fe4f4e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2024 License: MIT Imports: 0 Imported by: 0

README

Exercise 9.1 (P262)

Add a function Withdraw(amount int) bool to the gopl.io/ch9/bank1 program. The result should indicate whether the transaction succeeded or failed due to insufficient funds. The message send to the monitor goroutine must contain both the amount to withdraw and a new channel over which the monitor goroutine can send the boolean result back to Withdraw.

Documentation

Overview

Package bank provides a concurrency-safe bank with one account.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Balance

func Balance() int

func Deposit

func Deposit(amount int)

func Withdraw

func Withdraw(amount int) bool

Types

type Withdrawal

type Withdrawal struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL