Junior — Senior
The impact of append and slice operations on array contents
livecode
Task condition
Determine what output the program will produce when it is run:
package main
import "fmt"
func foo(s []int) {
s = append(s, 5)
}
func main() {
base := []int{1, 2, 3}
slice := base[:1]
foo(slice)
fmt.Println(slice)
fmt.Println(base)
}