Which is clearer form: if(!value) or if(flag == value)?

后端 未结 19 2776
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 19:07

I understand this is a subjective question, so I apologize if it needs to be closed, but I feel like it comes up often enough for me to wonder if there is a general preferen

19条回答
  •  渐次进展
    2020-12-23 20:01

    I am sorry to say, the second just looks stupid to me.

    I'd add an extra level, if someone prefers it:

    if( (value==false) == true )
    

    :)

提交回复
热议问题