Difference between “!= true” and “== false”?

后端 未结 2 1610
[愿得一人]
[愿得一人] 2020-12-17 04:22

Are there any technical/logical differences between the comparison \"!= true\" and \"== false\" in programming languages, and if there are, which comparison should be chosen

2条回答
  •  一整个雨季
    2020-12-17 05:06

    Use accordingly what your code block is expecting.

    e.g.

    • if your code block is expecting true then use if( true == fun() ) { // your code }.
    • if your code block is expecting any value except false then use if( false != fun() ) { // your code }.

提交回复
热议问题