IsIsogram implementation with only one exit point

I’m challenging myself to write to the coding standards of my job.
Part of that is only having one exit point in a function

bool FBullCowGame::IsIsogram(FString Guess) const
{
  /****************Variables and Initializtion***************/
  bool is_isogram_b = true;
  TMap<char, bool> LetterSeen;
  char Letter = '\0';
  /************************Begin*****************************/
  for (int32 letter_idx = 0; letter_idx < (int32)Guess.length(); letter_idx++)
  {
    Letter = tolower(Guess[letter_idx]);
    if (LetterSeen[Letter] == true)
    {
      is_isogram_b = false;
      break;
    }
    else
    {
      LetterSeen[Letter] = true;
    }
  }
  return is_isogram_b;
} //end FBullCowGame::IsIsogram

Privacy & Terms