Last active
June 15, 2016 17:25
-
-
Save narenaryan/01fab2bcc31efab65a33315d5404861e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main(){ | |
| s := []string{"Naren", "Saikiran"} | |
| // appending an element at the end of slice | |
| s = append(s, "Manoj", "Harish") | |
| fmt.Println(s) | |
| // removing element at the end | |
| s = s[:len(s)-1] | |
| fmt.Println(s) | |
| index := 1 | |
| // removing element at the nth index | |
| s = append(s[:index], s[index+1:]...) | |
| fmt.Println(s) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment