Skip to content

Instantly share code, notes, and snippets.

@tomtsang
Created February 14, 2018 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomtsang/d2bfdd456b59b766d902c26e866b8ea8 to your computer and use it in GitHub Desktop.
Save tomtsang/d2bfdd456b59b766d902c26e866b8ea8 to your computer and use it in GitHub Desktop.
slice-copy.go
package main
import (
"fmt"
)
func main() {
sliceA := []string{"a", "b", "c"}
fmt.Println(sliceA)
sliceB := []string{"k", "l", "m", "n"}
n1 := copy(sliceA, sliceB)
fmt.Println(sliceA)
fmt.Println(n1)
fmt.Println(sliceB)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment