Moving in and out of a do while loop?

I tried posting all of the code but it exceeded the maximum characters.

You can attach it to the post. Click on "Additional Options..." below the text entry box.