gpt4 book ai didi

ruby - Ruby 中 <=> 运算符的名称是什么?他们怎么调用它?

转载 作者:数据小太阳 更新时间:2023-10-29 07:11:11 27 4
gpt4 key购买 nike

在 Ruby 中有 <=>运算符(operator)。在 API 中,他们没有命名它的名字,只是:

The class must define the <=> operator...

Comparable uses <=> to implement the conventional comparison...

...the objects in the collection must also implement a meaningful <=> operator...

它叫什么名字?

最佳答案

参见上面的@Tony。然而,它也被称为(俚语)“宇宙飞船运算符(operator)”。

关于ruby - Ruby 中 <=> 运算符的名称是什么?他们怎么调用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15137987/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com