package main import "fmt" func main() {
//支持比较,只支持==或!=,比较是不是每一个元素都一样,2个数据比较,数据类型要一样
a := []int{,,,,}
b := []int{,,,,}
c := []int{,,}
fmt.Println("a == b ", a == b)
fmt.Println("a == c ", a == c) //同类型的数组可以赋值
var t []int
t = b
fmt.Println("t == ", t)
}
执行结果
a == b true
a == c false
t == [ ]