Hy Mike; I’ve a lot of your courses… congratulations.
Please, what’s your opinion about how I’ve done the for loop?
Notice that in the main for, I’ve coded Index < Word.Len() -1. I’ve done this code before see the solution, and I’ve done thinking in that is not necesary that Index arrives to Word.Len() because the variable Comparison will be always 1 greater than Index.
Thankyou for your response. It interests a lot to me, and sorry for my English.
Salvador
bool UBullCowCartridge::IsIsogram(FString Word) const
{
/*For each letter
Start at element [0].
Compare against the next letter
Until we reach [Word.Len()-1].
If any are the same return false*/
for (int32 Index = 0; Index < Word.Len() -1; Index ++)
{
for (int32 Comparison = Index + 1; Comparison < Word.Len(); Comparison++)
{
if (Word[Index] == Word[Comparison])
{
return false;
}
}
}
return true;
}