Created
March 11, 2015 00:11
-
-
Save CatTail/9bd6d379fd5e3195968b to your computer and use it in GitHub Desktop.
Prepend element into slice
This file contains 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
func prepend(arr []string, item string) { | |
return append([]string{item}, arr...) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
needs return declaration
func prepend(arr []string, item string) []string