A Tour of Go Slices

时间:2021-02-09 14:40:30

A slice points to an array of values and also includes a length.

[]T is a slice with elements of type T.

package main 

import "fmt"

func main() {
p := []int{, , , , , }
fmt.Println("p ==", p) for i := ; i < len(p); i++ {
fmt.Printf("p[%d] == %d\n", i, p[i])
}
}