切片 1、初始化:数组需要指定大小,不指定也会根据初始化的自动推算出大小,不可改变 数组: a := […]int{1,2,3} a := [3]int{1,2,3} 2、切片不需要指定大小 切片: a:= []int{1,2,3} a := make([]int, 5) a := make([]int, 5, 10) Food :=[]string{ "bread","Salad","egg"} fmt.Printf("切片操作:%q\n长度:%v\n容量:%v",Food[:2],len(Food),cap(Food)) Food = append(Food