I’m a little confused with this coding
int main()
{
int LevelDifficulty = 1;
while(true)
{
bool bLevelComplete = PlayGame(LevelDifficulty);
std::cin.clear(); //Clears any errors
std::cin.ignore(); //Discards the buffer
if (bLevelComplete)
{
++LevelDifficulty;
}
}
return 0;
}
Why use an if statement?
I see without it the LevelDifficulty will increase even if you return a false from PlayGame
Or are we implying if “if (bLevelComplete)” is true then ++LevelDifficulty?
But then where are we stating that this happens it it’s true?
if (bLevelComplete) could also accept a false value cant it?
What triggers it if only true?
Or is it triggered if PlayGame is a boolean?
So when PlayGame returns a false, it no longer is a boolean, and so the if statement is not triggered?