I cant figure out how to break out of a loop

i am trying to make it so you click a square to break an infinite loop, but it wont work

Hi @Keegan_White,

you can create a boolean variable, set it to “true” and use “Repeat while (variable)” block for your infinite loop. When the square is clicked, you can switch the variable to “false” and the loop will be broken.

Hope that helps

i am trying to make it so you click a square to break an infinite loop, but it wont work

thanks Nicolay. :):slight_smile:

I made an example for you. Feel free to remix and investigate the code

1 Like

But @Nikolay, when it is only one coblock it is quite simple. But sometimes I need that variable to be known in all coblocks. I haven’t figured out how yet.

You can use global function for this.

Please, take a look at this example

1 Like