sf
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
module main
|
||||||
|
|
||||||
|
go 1.24.5
|
||||||
@@ -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)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user