Bulls and Cows not being affected by if statement

So My problem is that my bulls and cows iterating seems to be unaffected by the code running here.
I’m not sure why, I’ve checked that it’s being called on my main.cpp and it is, and my code seems to be identical to the code in the tutorial video.

I’m not quite sure what’s causing my problem, I have noticed that the square brackets highlight and turn green in the video, and not in my code. but as far as i can see, that is the only difference.

Thanks, here’s the code I have:

FBullCowCount FBullCowGame::SubmitGuess(FString Guess)
//increment the turn number
//setup return variable
FBullCowCount BullCowCount;

//loop through all letters in the guess
int32 HiddenWordLength = MyHiddenWord.length();

for (int32 HWChar = 0; HWChar < HiddenWordLength; HWChar++)
	for (int32 GChar = 0; GChar < HiddenWordLength; GChar++)
		if (Guess[HWChar] == MyHiddenWord[HWChar])
			if (HWChar == GChar)//if they are in the same place
				BullCowCount.Bulls++; // increment bulls
				BullCowCount.Cows++; // increment cows

return BullCowCount;


You’re using the same index for both words.

1 Like

A simple misspell
thankyou, Bulls are now being counted, Cows still aren’t.
but it shouldn’t be to hard to find the rest of the problem

And now totally fixed
Thankyou for the help