+// The index starts at 0 and increments by one at each iteration as long as the nested if statement is not triggered. In the case of find("code your future", "u"), the if statement is triggered at index 7 because a match is found for letter u at this index. The while loop is exited and the number 7 is returned by the find function. In the case of find("code your future", "z") no match is found by the time the while loop terminates. In this case the find function returns -1 to indicate the letter z was not found in the string
0 commit comments