add: arrays

This commit is contained in:
Inanc Gumus
2018-11-17 21:56:09 +03:00
parent c0dbce8062
commit a3a0d39a0b
138 changed files with 2022 additions and 1905 deletions

View File

@@ -57,7 +57,20 @@ func main() {
for i := range sBooks {
sBooks[i] = books[i+1]
// changes to sBooks[i] will not be visible here.
// sBooks here is a copy of the original array.
}
// changes to sBooks are visible here
// sBooks is a copy of the original sBooks array.
//
// v is also a copy of the original array element.
//
// if you want to update the original element, use it as in the loop above.
//
// for _, v := range sBooks {
// v += "won't effect"
// }
fmt.Printf("\nwinter : %#v\n", wBooks)
fmt.Printf("\nsummer : %#v\n", sBooks)