November 2017
Intermediate to advanced
670 pages
17h 35m
English
Let's look an example of some imperative code:
type Dividend struct { Val int}func (n Dividend) Divide(divisor int) int { return n.Val/divisor}func main() { d := Dividend{2} fmt.Printf("%d", d.Divide(0))}
What is our contract in the preceding code?
The contract is our method's signature: func (n Dividend) Divide(divisor int) int
What three questions must our contract answer?
What happens when we run the preceding ...