我需要创建一个函数:
returns true if all elements in a slice are equal (they will all be the same type)
returns false if any elements in a slice are different
我能想到的唯一方法是反转切片,并比较切片和反转切片。
有没有更好的方法来做到这一点,即好的语法和更有效的?
守候你守候我
相关分类