Is there a comparison Operator that returns true if both values are set and equal: false if both are nil

前端 未结 0 1745
不知归路
不知归路 2020-12-16 20:29

Is there an ideomatic or shorter way to "compare two values but don\'t allow them to be nil".

One way would be:

(!left.nil? || !right.nil?) &         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题