Skip to content

Instantly share code, notes, and snippets.

@geekoff7
Created September 27, 2018 16:05
Show Gist options
  • Select an option

  • Save geekoff7/b3d4cf2015e47e83b7551f305925194e to your computer and use it in GitHub Desktop.

Select an option

Save geekoff7/b3d4cf2015e47e83b7551f305925194e to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func main() {
var arr1 [2]string = [2]string{"A", "B"}
var slice1 = arr1[:]
slice1[0] = "a"
fmt.Println("slice1 ",slice1)
fmt.Println("arr1 ",arr1)
var arr2 [2]string = [2]string{"C", "D"}
var slice2 = arr1[:]
slice2 = append(slice2,"E")
slice2[0] = "c"
fmt.Println("slice2 ",slice2)
fmt.Println("arr2 ",arr2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment