gpt4 book ai didi

ruby - Ruby 中的运算符 <=>

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

<分区>

Possible Duplicate:
What is the Ruby <=> (spaceship) operator?

我看到了一段代码和一个我不熟悉的运算符

 @array << {:suffix=> substring, :index => i}
@array.sort! { |x,y| x[:suffix] <=> y[:suffix]}

我无法对其进行谷歌搜索。什么是<=>做?

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