[Solved] How does the while loop know when to stop?

[ad_1]

The while loop stops when the function exits, and the function exits when the return statement is executed.

The return statement is executed when s.find() returns -1, which means that t was no found in s when searching from last_pos + 1 onwards.

[ad_2]

solved How does the while loop know when to stop?