30 ms·
I don't understand what you mean by this. [~] $ cat main.go package main import "fmt" func main() { x := []int{1, 2} append(x, 3) fmt.Print
by sqlcommando 4y ago
I don't understand what you mean by this.
[~] $ cat main.go
package main
import "fmt"
func main() {
x := []int{1, 2}
append(x, 3)
fmt.Println(x)
}
[~] $ go run main.go
# command-line-arguments
./main.go:7:2: append(x, 3) (value of type []int) is not used
and if you assign the result of the append to something else, x is unchanged.