Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7024695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:52:32+00:00 2026-05-27T23:52:32+00:00

There is continue; to stop the loop and move to the next loop There

  • 0
  • There is continue; to stop the loop and move to the next loop
  • There is break; to stop the loop and move to the end of the loop

Isn’t there some kind of start; that stop the loop and move to the beginning of the loop?

I know it is easy to achieve all of these three actions by just modifying the value of i, but I always try to look for already built-it functions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:52:32+00:00Added an answer on May 27, 2026 at 11:52 pm

    No – there is no keyword or other way to do it automatically.

    As you already mentioned you can just modify the loop condition variable(s) within your loop. Easy if it’s a simple i counter, but of course you may have more initialisation to do than just a simple counter.

    Or you can do something like the following:

    restartLoop:
    while (true) {
       for (var i=0, j=100000, x="test"; i < 1000; i++, j--, x+= ".") {
          if (/*some condition, want to restart the loop*/)
              continue restartLoop;
       }
       break;
    }
    

    The continue restartLoop will jump back out to continue with the next iteration of the while loop, which then immediately starts the for loop from the beginning including all of the initialisation code. If the for exits normally the break statement after it will break out of the containing while loop.

    I don’t really recommend doing this in a general sense, but if your loop initialisation process was really complicated it could be worth it because then you wouldn’t need to repeat it all inside the loop. If you needed to do even more initialisation than fits nicely in the for statement’s initialisation expression you can easily put it just before the for loop inside the while and it will all be re-run…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there some kind of trick involved? Here's how I would envision it working:
Is there a way to continue to utilise auto-implemented properties while still raising a
Is it possible to continue the alteration styles in a gridview even when there
There is a conversion process that is needed when migrating Visual Studio 2005 web
Is there any way to stop the execution of a matlab program from the
I have a thread that is doing some processing. I would like to be
You may know a lot of programs, e.g some password cracking programs, we can
Is there a way to stop a close event for a jQuery UI Dialog?
Say I have a loop in my code that calls the rails debugger a
I have a JavaScript function that contains a for loop that iterates so many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.