1. 数组: n

  2. 切片: n[1:] n[:1] n[1:1] n[1:2]

  3. 获取数据类型: reflect.TypeOf()

package main

import (
	"fmt"
	"reflect"
)

func main() {
	var n [5]int = [5]int{0, 1, 2, 3, 4}

	fmt.Println("n = ", n)
	fmt.Println("n[1:] = ", n[1:])
	fmt.Println("n[:1] = ", n[:1])
	fmt.Println("n[1:1] = ", n[1:1])
	fmt.Println("n[1:2] = ", n[1:2])
	fmt.Println(reflect.TypeOf(n))
	fmt.Println(reflect.TypeOf(n[1:2]))
}

n = [0 1 2 3 4]
n[1:] = [1 2 3 4]
n[:1] = [0]
n[1:1] = []
n[1:2] = [1]
[5]int
[]int