TripleX : Why an if statement?

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?

That’s how if (and while for that matter) works. The code inside will only execute if the condition is true and bLevelComplete is a bool so holds the value true or false. If it has the value of true it will go into that block otherwise it won’t.

But where are we implying that bLevelCompete must be true in order to trigger the if statement?
There is no operator used in it.

Or does the while(true) statement assign all functions within it’s scope are looking for true conditions?

By using the variable. It holds the value true or false and the if statement will check that value.

So do if statement also run a function at the same time?

In the Bull & Cow game, we have the code

if (!IsIsogram(Guess))  // Check if Isogram
        {
            PrintLine(TEXT("No repeating characters, guess again"));
            return;
        }

Now when I look at this, I see that if IsIsogram(Guess) is false, then printline
To me I dont see this as a command to actually run IsIsogram()

But when you run the code, it actually runs the IsIsogram()
And since we are returning true in that section, it prints out each letter of the guess

idk, I think I’m getting confused with the shortening and merging of codes.

Like is the above code just a shorter way of writing

IsIsogram(Guess);

if (IsIsogram(Guess) == false)
        {
            PrintLine(TEXT("No repeating characters, guess again"));
            return;
        }

IsIsogram(Guess) calls the function. It doesn’t matter if it’s used as part of another experssion, it still calls the function. An example I gave on Udemy in triplex

void Example(bool thing);
int main()
{
    PlayGame();
    bool bTest = PlayGame();
    Example(PlayGame());
    bool OneMore = PlayGame() || PlayGame();
}

PlayGame is called 5 times in the code above.

No, as explained previously that would call the function twice.

bool bIsIsogram = IsIsogram(Guess);

if (bIsIsogram == false)

This would be the equivalent.

Let’s say in your example
PlayGame() simply prints out “Hello World”

How many times will your example code print out “Hello Word”

5 if we pretend short circuit evaluation doesn’t exist otherwise 5 or 4 depending on whether the first PlayGame in PlayGame() || PlayGame() returns true.