Is anybody using the named boolean operators?

前端 未结 13 2216
南方客
南方客 2020-12-06 10:52

Or are we all sticking to our taught \"&&, ||, !\" way?

Any thoughts in why we should use one or the other?

I\'m just wondering because several answe

13条回答
  •  独厮守ぢ
    2020-12-06 11:22

    I like the idea of the not operator because it is more visible than the ! operator. For example:

    if (!foo.bar()) { ... }
    
    if (not foo.bar()) { ... }
    

    I suggest that the second one is more visible and readable. I don't think the same argument necessarily applies to the and and or forms, though.

提交回复
热议问题