Best way to "continue" a loop?

I can use the "stop this script" or "stop this block" to break out of a loop.

Is there a best approach for using "continue"?

My best approach so far is isolating the loop into its own script upon when I receive ... then broadcast and stop this script to restart another instance. It isn't clean. I would love to just restart the loop.

what do you mean by "restart the loop"?

What I would do is make a loop like this:

untitled script pic (9)
However, something like this is more compact:
untitled script pic (11)

Hope this helps!

The catch block from the tools library. Put it inside the loop for continue, and outside the loop for break.

1 Like

The best thing I could suggest for restarting a loop is using my project's custom blocks. Here's the project.
Use these blocks:

Script Saving script pic

Script Saving script pic (1)

Script Saving script pic (2)

Script Saving script pic (3)

The FOR I=1 TO 100 is the loop we're trying to continue or break out of. The stuff in the REPEAT 10 is just a random way to spend enough time in each value of I in the FOR loop so you can type C for continue or B for break and tell that it worked -- B just stops the whole loop, but C goes to the next value of I. @spaceelephant had this idea, but there's no more Tools library; the CATCH and THROW blocks are in Iteration, the first library in the list.

1 Like