James Calder James Calder - 2 months ago 11x
C++ Question

C++ &&, ||, and ! meaning?

What do the operators

, and
mean in C++. I know they evaluate to
or false`, but what is there exact meaning? They seem very vague, as I am coming from a python background, and have never seen such symbols? Thanks!


Wow, these are one of the most fundamental operators of C++, and their purposes are as follows:

  1. ! means, logical not. For example, !false will evaluate to true, since false is not true
  2. && checks both sides of its operands, to see if both sides evaluate to true. Example, true && true will evaluate to true and false && true will evaluate to false
  3. || means or, and it checks if one of both operands it has are true. Example true || false will evaluate to true, while false || false, will evaluate to false.