DEV Community

vinay
vinay

Posted on

how to delete the Element in slice using Slice Golang

#go
//how to delete the Number in Slice Golang
    a := []int{10, 20, 30, 40, 50, 60, 70, 80, 90}
    var i int
    fmt.Print("Enter deleted number index..: ")
    fmt.Scan(&i)
    a = append(a[:i], a[i+1:]...)
    fmt.Println(a)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)