func MaxMin(position [][]float64) (max, min []float64) {
for k, v := range position {
if k == 0 {
max = position[k]
min = position[k]
continue
}
if v[0] > max[0] {
max[0] = v[0]
}
if v[1] > max[1] {
max[1] = v[1]
}
if v[0] < min[0] {
min[0] = v[0]
}
if v[1] < min[1] {
min[1] = v[1]
}
fmt.Println(v)
}
return
}
the last return value is always the last bit of traversal, which should be affected by the characteristics of slice
optimize