Created
March 29, 2014 08:39
-
-
Save atotto/9850837 to your computer and use it in GitHub Desktop.
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
package append_test | |
import "fmt" | |
func ExampleArrayToSlice() { | |
arr := []string{"a", "b", "c"} | |
//arr = append(arr, arr) // Compile error : cannot use arr (type []string) as type string in append | |
arr = append(arr, arr...) | |
fmt.Printf("%v", arr) | |
// Output: | |
// [a b c a b c] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment