Quick actions

cmd+k|ctrl+k

Navigation

Languages

Slices / Remove elements from slice / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-04-18T17:11:19Z

Updated

2019-04-18T17:11:19Z

package main

import "fmt"

func main() {
	s := []int{10, 11, 12, 13}

	i := 2 // index of 12
	s = append(s[:i], s[i+1:]...)

	fmt.Printf("s: %#v\n", s)
}
INFO