Go Tutorial Part 5 Slices and Arrays
Contents
- Array: Fixed Length list
- Slice: An array that grow and shrink
- Every single record must have the same type
|
[]string: define a slice of type string{"Ace of Diamond", newCard()}: initialize with valuesappend(cards, "Six of Spades"): append a new value to the slice and returns a new slice- Slices index start with 0
- indexing:
slice[0] - indexing:
slices[startIndexIncluding: upToNotIncluding] - ignore the
startIndexIncludingto start from start - ignore the
upToNotIncludingto go till the end