By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,808 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

How can I repeat this code?

P: 1
Ok.. I'm not retarded or anything I just don't know this stuff >_<

<block of statements>

Repeat? Y/N

When I do press Y the code will repeat and by pressing N it will terminate the do I do this?
Sep 4 '06 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
You can use a confirm dialog box. Use the return value (true/false) to either repeat or stop with the block of statements in a do..while loop, e.g.
Expand|Select|Wrap|Line Numbers
  1. var torepeat = false;
  2. do {
  3.     // some statements
  4.     torepeat = confirm("Do you wish to repeat?");
  5. } while (torepeat);
May 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.