func prime(x, y int) []int{
z := []int{}
for i := x; i < y; i++ {
for j := 2; j < i; j++ {
if i%j == 0 {
break
} else {
z = append(z, i)
break
}
}
}
return z
}
func sum(xi []int)int {
sum := 0
for _, v := range xi {
sum += v
}
return sum
}
func main() {

Nice that you put it in go playground The error in that code is that in the last example is sum called with 10 for both arguments sum(10, 10) instead of sum(10, 100) or something similar.