Created
September 27, 2018 16:05
-
-
Save geekoff7/b3d4cf2015e47e83b7551f305925194e 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() { | |
| 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