Using (!=) & an else statement for the comparison is not working

Hi,
I tried to use the for loop differently for the sake of experimentation, however, this is not working, and I want to understand why.

1 Like

the only thing that your function is doing is looking at the first letter and comparing it to the next one. If it matches then it will return true, if it does not then it returns false.

Remember when you use return, it will exit the function.

1 Like

Thanks a lot now it is clear, so when my if statement return true, the functions stops.

1 Like

yes exactly. It also stops when it return false.

1 Like

Thanks alot Mikapo

1 Like

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

Privacy & Terms