I am using javascript, but I am looking for a general purpose solution that can be applied to multiple languages.
I want the while loop to work one time longer than expected.
For example (suppose the variables are defined above):
while (x != ">") { i++; tempStr += x; x = text[i]; }
Thus, the code above would have tempStr last character ">" .
It is important to remember that I'm not just trying to do something like this:
while (x != ">") { i++; tempStr += x; x = text[i]; } tempStr += x;
The above example is just one example where it would be convenient to start the while loop for one final loop after the condition is false. And that’s all, although I can’t share my actual code with you (for legal reasons), just know that the above will not be the solution for the application that I have in mind.
It may not be possible to do what I am trying to do, if so, let me know :)
source share