The stop [this block] option doesn't seem to work

I expected the stop [this block] block to behave like a break statement (exiting the loop but continuing the script).

Therefore, I was expecting the output to be: 1, 2, 3, Hello!

However, “Hello!” is never outputted.

It seems to stop the entire script instead.

Is this a bug with the stop block?

This is intended behavior, since stop [this block V] stops the currently running custom block.

In order to get what you’re wanting to do, you have to load the iteration composition library, and use catch and throw.

Behind the scenes this uses continuations, which I still don’t have a full grasp on them, I just know they can give you the break effect.

Behind the scenes this uses continuations, which I still don’t have a full grasp on them, I just know they can give you the break effect.

CATCH sets its upvar TAG to its continuation, i.e., what’s left to do after the CATCH finishes, namely the SAY HELLO block in this case. THROW just abandons the current computation and instead runs the saved continuation, i.e., it goes straight to the SAY HELLO.

I’ve been confused by this for a long time, but now I finally understand! Thank you both very much for the detailed explanations!