Repeat Until.. Block



The “Repeat Until…” block. Now, before you start running around like crazy how “AHHhh you should put this in a suggestions post”, just calm yourself. This is both a suggestion for a future update and a way to mimic this block until it is added.
The idea of “Repeat Until…” is a Control Block in which the blocks inside will be repeated, over and over, until a certain condition is reached, such as a value hitting a certain number. Ex:
Repeat Until Value = 1
Change Color Random
This would be useful as, say, creating a game where something is repeating something over and over until the player dies. Now, until such an idea is available, I have put together the string of code below. The block with the star next to it is the block that will be repeated until the conditions are met.
Repeat Forever
Change Color Random :eight_spoked_asterisk:
Check Once If Value = 1
Repeat Forever
(Optional: Insert an unaffecting block, like set invisibility 0 or set size 100. You don’t need anything here, though)
I actually came across this while coding a game, and decided to share this for anyone who may want it. I know the logic is very simple, but hey, it doesn’t hurt to just lay it out for you. If requested, I will show pictures.


At least two other people (me and @t1_hopscotch) had the idea(separately.) to do this:


Best method for doing this is probably the one @Petrichor posted, but here's another method for doing it anyway:

// In this example, 10 is the target number.
// However, you can change it to be whatever you like.

when variable < 10:
 // Put whatever blocks you want.


Oooh great approach, @Hoppertoscotch!

And that is cool too @Petrichor :smiley: I am not surprised others came about it independently too; I was inspired after seeing some code for recursion in the app.


Now that you mention that, I remembered with a Repeat Forever you're able to put code before it in the rule, but not afterwards :thinking:


Oh yeah! Or you could insert a wait block.


I like this approach but it can vary


Simple just use variables like everyone else has said. Set what ever action you want to repeat to some variable (let's say "variable) and then when it finishes set variable to 1.
When 7=7
Check If Else If Variable=1
Keep Doing


But that can't be adapted to wait until. However, it doesn't require an ability.