Skip to main content
3 of 3
edited tags
gnat
  • 20.9k
  • 29
  • 115
  • 295

Why Use !boolean_variable Over boolean_variable == false

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?

ell
  • 966
  • 1
  • 10
  • 14