If else satement at end of FBullCowCount FBullCowGame::SubmitValidGuess(FString Guess)

I may be wrong, but we set the value of bGameIsWon to false in reset which is called by the constructor.
The status of the bool never changes from false unless bulls == wordlength.
So… why is there an else? It is effectively redundant surely?

Never assume, when programming a class. Always focus on only the class. Act like the rest of your program doesn’t exist. How are you to be sure that the class will be deconstructed before another bull cow game is started?

There is no guarantee, rather add a ‘redundant’ check to be an airbag. If it’s never used, then nothing lost. If it’s needed to check a state for which you have no code for, you’ll greatly appreciate it being there.

Privacy & Terms