Simpler way?

I actually did it like this:

     for (; Comparison < Word.Len(); Index++, Comparison++)
            if (Word[Index] == Word[Comparison]) {
                return false;

and it seems to be working fine, any reason not to?


Index and Comparison aren’t used outside of the loop so there’s no reason not to minimise their scope to the loop.

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

Privacy & Terms