// Homework 30, problem 2: Clamped health. // // Design a health type: // newHealth(maxHealth) -- returns a *health and an error; maxHealth must // be above 0, and health starts full // heal(n) -- raises health, never above maxHealth // damage(n) -- lowers health, never below 0 // get() -- reads the current health // // heal and damage return an error when n is below 0. The rule to protect: // health stays between 0 and maxHealth. // // Run with: go run exercises/30/homework/02-health.go package main import "fmt" // TODO: define the health struct, newHealth and the methods here, outside main. func main() { // TODO: write your code here, in place of this placeholder line: fmt.Println("TODO: replace this line") }