This commit is contained in:
anpivkin 2026-01-07 09:07:11 +03:00
parent 8aceabf0f1
commit 2e763f0dd6
2 changed files with 6 additions and 3 deletions

View File

@ -0,0 +1,3 @@
module main
go 1.24.5

View File

@ -11,10 +11,10 @@ func (p *Point) Inc() {
} }
func main() { func main() {
points := []*Point{{1},{2},{3}} points := []Point{{1},{2},{3}}
for _,p := range points { for i := range points {
p.Inc() points[i].Inc()
} }
fmt.Println(points[0].x) fmt.Println(points[0].x)
} }