Expression Must Have Class Type

Getting this error when I add the .Len()

Expression must have Class Type.

I get the error on HiddenIndex.Len()

void UBullCowCartridge::GetBullCows(const FString& Guess, int32& BullCount, int32& CowCount) const
{
    BullCount = 0;
    CowCount = 0;

    //for every index of Guess is the same as the index Hidden, BullCount ++
    //if not Bull, was it a Cow? if yes CowCount ++

    for (int32 GuessIndex = 0; GuessIndex < Guess.Len(); GuessIndex++)
    {
        if (Guess[GuessIndex] == HiddenWord[GuessIndex])
        {
            BullCount ++;
        }
        
        for (int32 HiddenIndex = 0; HiddenIndex < HiddenIndex.Len(); HiddenIndex++)
        {
            if (Guess[GuessIndex] == HiddenWord[HiddenIndex])
            {
                CowCount ++;
            }
        }
    }    
}

for (int32 HiddenIndex = 0; HiddenIndex < HiddenIndex.Len(); HiddenIndex++)

HiddenIndex is an int32 which doesn’t have any members. You perhaps meant HiddenWord.Len()

1 Like

Thanks Dan, I was able to fix it and it was exactly as you mentioned, HiddenWord.Len()

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.