Struggling with Task and word

“I could set it to I, but I want to set it to something else like Index.” - Is this just the name assigned by him? Or is this something more I missed?

So I am also having an issue with the use of ‘Word’ here.

bool UBullCowCartridge::IsIsogram(FString Word) const

{

for (int32 Index = 0; Index < Word.Len(); Index++)

{

    PrintLine(TEXT("%c"), Word[Index]);

}

How is Word getting the ‘Guess’? No where have we coded this, what am I missing?

Also, after this he initialises ’ IsIsogram(HiddenWord); ’
within ’ SetupGame ’
It simply takes place of ‘Word’ in our code and runs? How does it know to do that? Since I don’t understand I feel I have no hope of writing this code myself.
Thanks

Is it being elevated to ‘IsIsogram’ through this code?

if (!IsIsogram(Guess))

{

    /* code */

    PrintLine(TEXT("There are no repeating letters, guess again"));

}

PrintLine(TEXT("Wrong word, right length, \nYou have %i Lives remaining... Try again"),Lives);

The function IsIsogram(FString Word) takes any FString you can put into it when you call it. Since you already have the HiddenWord, and you get the Guess from the OnInput Function, you put either one of those variables into the IsIsogram function as its arguments.

You might need to go back to ‘Creating Our First Function’ tutorial if it is still confusing: Creating Our First Function | GameDev.tv

1 Like

That calls the function, yes. It can’t know what it returns (and thus used to evaluate the condition for the if) without calling it.

1 Like

Thank you!

Privacy & Terms