package main
import (
"fmt"
)
func main() {
a:=[]int32{2,56,4}
b:=[]int32{7,56,6}
fmt.Println(compareTriplets(a,b))
}
func compareTriplets(a []int32, b []int32) []int32 {
scores:=[]int32{}
for i:= 0; i < 3; i++ {
if a[i] > b[i]{
scores[0]++
}
if a[i] < b[i]{
scores[1]++
}
}
return scores
}
scores:=[]int32{}
scores[0]++
scores = append(scores, newItem)
. Конкретно для вашего кода - целесообразно через var scores [размер]тип
var scores [2]int32
var scores []int32
scores = make([]int32, 2, 2)
// Или сразу
scores := make([]int32, 2, 2)