I've been reading the C++ for dummies book and I'm loving it! I'm on the section where he is talking about short circuit evaluation. Here is my understanding of short circuit evaluation.
Short circuit evaluation is only applied to bitwise operators, for example AND && and OR ||. So if condition1 is not true then the whole statement is not true!
I've been trying to get my head around this concept by using the following code.
#include <iostream>
using namespace std;
int main()
{
bool condition1 = true;
bool condition2 = false;
if (condition1 && condition2)
{
cout << "The statement is true!";
}
else
{
cout << "The statement is false.";
}
}
But I'm returned with the statement being false have I grasped this concept the wrong way?