为什么飞船操作员中只有一个等号? [英] Why does the spaceship operator have only one equal sign in it?
本文介绍了为什么飞船操作员中只有一个等号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么选择宇宙飞船操作员<=>
具有一个等号而不是两个?这是否被视为与一个等号不一致,通常表示赋值,而两个意思比较不一致?
Why was the spaceship operator <=>
chosen to have one equal sign rather than two? Is this seen as inconsistent with one equal sign usually meaning assignment, and two meaning comparison?
推荐答案
为什么会有两个? <=
,>=
和!=
中只有一个.一点也不矛盾.只有==
是不一致的,这是为了避免与赋值运算符发生冲突.
Why would it have two? There's only one in <=
, >=
and !=
. It's not inconsistent at all. Only ==
is inconsistent, and that's to avoid conflicts with the assignment operator.
这篇关于为什么飞船操作员中只有一个等号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文