package main import "fmt" type hero struct { name string hp int maxHP int } func newHero(name string, hp int) hero { return hero{name: name, hp: hp, maxHP: hp} } func main() { party := []hero{ newHero("Ada", 100), newHero("Ben", 80), newHero("Cara", 120), } total := 0 for _, h := range party { total = total + h.hp } fmt.Printf("Team HP: %d\n", total) // Team HP: 300 }