According to mdn logical operators page Explaining considering the scenario true == true Given this information, i would expect false &&
Photo of Kyle
True || true to evaluate to false.
Bool is an integral type but not an integer.
The confusion lies here because of the use of string literals to represent boolean values If you reverse the 'false' and 'true', it makes more sense 'false' would return the string literal false, which is much different than a boolean value 'true' reads as if not true, then return the string literal true
So in false && false, the left side is falsey, so the expression returns the left side, false I've actually written a blog post about the || and && operators. Op meant to be didatic, but i see caveats 1) true and false are builtins and even accept arguments 0 and 1 are exit codes of the true and false commands, respectively.
@ashwinichaudhary true and false are singletons
The bool constructor will return either true or false by identity, so you cannot create a boolean value that won't compare equal to either true or false using is. In ada (true and true) or (false and false) would evaluate both (true and true) and (false and false) before evaluating the or Ada also gives you the ability to short circuit with and then and or else, which will give you the same behavior c++ does.