I decided to add “- 1” in condition of the 1st for loop, since we only have to compare “Index” to “Comparison” until Index is equal to Word.Len() - 2 (we don’t have to compare the same positions).
Do I think correctly?
I’ve tested my code and it works fine, but I’m not sure if that’s a good practice.
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;
}
}
}