3. Make
// func make([]T, len, cap) []T
mySlice := make([]int, 5, 10)
// the capacity argument is usually omitted and defaults to the length
mySlice := make([]int, 5)mySlice := []string{"I", "love", "go"}Length
mySlice := []string{"I", "love", "go"}
fmt.Println(len(mySlice)) // 3Capacity
mySlice := []string{"I", "love", "go"}
fmt.Println(cap(mySlice)) // 3Indexing
Assignment
1
2