Character Check: Single and looking

Here is my single character check and comparison:

bool UBullCowCartridge::IsIsogram(FString Word) const
{
    int32 Index = 0;
    int32 Comparison = Index +1;

    for (; Comparison < Word.Len(); Comparison++)
    {
        if (Word[Index] == Word[Comparison])
        {
            return false;
        }
       
    }
    
    return true;
    
    // for each letter
    // start at element [0]
    // Compare against the next letter
    // Until we reach [Word.Len() -1]
    // if the any letters are the same return false.
    
   
}

I forgot the return false when I initially went through it, but I was able to get it running. Of course it did not jump back into ProcessGuess, but that is fine.

At first I could not get it running until I realized “Of course, we are checking the first letter against the others!” My error checking method was incorrect, not the code. I was writing words such as “Woord” and “Wrrrrrd”. See the issue?

1 Like

Seems to be a problem :thinking:

Privacy & Terms