golang两切片的值比较_比较Go值

golang两切片的值比较

按类型比较 (Comparability by type)

Basic data types are always comparable using the == and != operators: integer values, floating-point numbers, complex numbers, boolean values, string values, constant values.

基本数据类型始终可以使用==!=运算符进行比较: 数值, 浮点数复数布尔值, 字符串值, 量值。

Array values are comparable, if they contain a comparable element type

如果数组值包含可比较的元素类型,则可比较

Pointer values are comparable.

指针值是可比较的。

Channel values are comparable.

通道值是可比较的。

Interface values are comparable.

接口值是可比较的。

Comparing interface values works only if the dynamic type is comparable.

仅当动态类型可比较时,比较接口值才有效。

Function values, Slice values and Map values are not comparable, they can only be compared with nil, as a special case.

函数值, Slice值和Map不可比较,在特殊情况下只能与nil进行比较。

比较规则 (The rules of comparison)

From the Go spec:

从Go规范:

  • Boolean values are comparable. Two boolean values are equal if they are either both true or both false

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值