I'm getting an error that says "control may reach end of function" and I have gone through my code several times now and am not spotting the error. It may be something simple too.
// loop continually until the user gives a valid guess
FText GetValidGuess()
{
EGuessStatus Status = EGuessStatus::Invalid_Status;
do {
// get a guess from the player
int32 CurrentTry = BCGame.GetCurrentTry();
std::cout << "Try " << CurrentTry << ". Enter your guess: ";
FText Guess = "";
std::getline(std::cin, Guess);
// check status and give feedback
Status = BCGame.CheckGuessValidity(Guess);
switch (Status) {
case EGuessStatus::Wrong_Length:
std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n";
break;
case EGuessStatus::Not_an_isogram:
std::cout << "Please enter a word witout repeating letters.\n";
break;
case EGuessStatus::Not_Lowercase:
std::cout << "Please enter all lowercase letters.\n";
break;
default:
return Guess;
}
std::cout << std::endl;
} while (Status != EGuessStatus::OK); // keep looping until we get no error
}
Status != EGuessStatus::OKis always true. So it assumes that it might be true or false - and if it's false, then the computer would get to the end of the function without returning anything. \$\endgroup\$