Answers for "go slice pop"

Go
0

go slice pop

// Pop last
slice := []int{1,2,3,4,5}
poppedVal := slice[len(slice)-1]
slice := slice[:len(a)-1]
fmt.Println(slice) // [1,2,3,4]
Posted by: Guest on May-12-2021

Browse Popular Code Answers by Language