[Go] Go语言获取数组长度 →→→→→进入此内容的聊天室

来自 , 2019-04-27, 写在 Go, 查看 150 次.
URL http://www.code666.cn/view/2ea6241c
  1. // getting the length of an array is silly, because the length is part of the array's static type
  2. myArray := [3]int{1, 2, 3}
  3. fmt.Println(len(myArray)) // prints 3
  4. // getting the length of a slice
  5. mySlice := []int{1, 2, 3}
  6. fmt.Println(len(mySlice)) // prints 3
  7. //go/4625

回复 "Go语言获取数组长度"

这儿你可以回复上面这条便签

captcha