package main
import (
"fmt"
)
type Person struct {
Name string
Age int
}
func Persons() []Person {
persons := []Person{
Person{"Aaron", 30},
Person{"Harold ", 20},
Person{"Ted", 5},
}
return persons
}
func main() {
persons := Persons()
for _, person := range persons {
fmt.Printf("%s: %d\n",person.Name, person.Age)
}
}
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme