Skip to main content
edited tags
Link
gnat
  • 20.9k
  • 29
  • 115
  • 295
Question Protected by gnat
replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Source Link

A comment on this question: http://programmers.stackexchange.com/questions/136900/calling-a-method-that-returns-a-boolean-value-inside-a-conditional-statementChecking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional? says that you should use !boolean instead of boolean == false when testing conditions. Why? To me boolean == false is much more natural in English and is more explicit. I apologise if this is just a matter of style, but I was wondering if there was some other reason for this preference of !boolean?

A comment on this question: http://programmers.stackexchange.com/questions/136900/calling-a-method-that-returns-a-boolean-value-inside-a-conditional-statement says that you should use !boolean instead of boolean == false when testing conditions. Why? To me boolean == false is much more natural in English and is more explicit. I apologise if this is just a matter of style, but I was wondering if there was some other reason for this preference of !boolean?

A comment on this question: Checking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional? says that you should use !boolean instead of boolean == false when testing conditions. Why? To me boolean == false is much more natural in English and is more explicit. I apologise if this is just a matter of style, but I was wondering if there was some other reason for this preference of !boolean?

Post Made Community Wiki by Konrad Rudolph
Tweeted twitter.com/#!/StackProgrammer/status/173555255404003328
Source Link
ell
  • 966
  • 1
  • 10
  • 14

Why Use !boolean_variable Over boolean_variable == false

A comment on this question: http://programmers.stackexchange.com/questions/136900/calling-a-method-that-returns-a-boolean-value-inside-a-conditional-statement says that you should use !boolean instead of boolean == false when testing conditions. Why? To me boolean == false is much more natural in English and is more explicit. I apologise if this is just a matter of style, but I was wondering if there was some other reason for this preference of !boolean?