In the first example, you assign the substring back to x. This makes x shorter each time it loops. Therefore the loop will be executed less times than in the second example. This process goes faster and faster as you take substrings of substrings...
In the second example x is not modified (the substring method itself does not modify the string)and therefore will nicely give you as many substrings as x is long.
posted 11 years ago
I got that, thanks bart
What's wrong? Where are you going? Stop! Read this tiny ad:
how do I do my own kindle-like thing - without amazon