Repeat Until/Do While code

Although we don’t have a Repeat Until/Do While block, people have found ways of doing this manually :smiley:

This way involves putting code in an ability and it will keep on calling itself while a condition is true:


(This will repeat setting its color to purple while ValueB = 1. Alternatively you can change the condition to a Not Equals for Repeat Until conditions.)

You could also use a Repeat Forever which continually checks if something meets a condition and stops when it doesn’t. Credits to AwesomeCilantro for this!


However, you won’t be able to add more code to this rule though, or it won’t run.

A while ago, I made a project including these two examples too:

20 Likes

I knew I couldn’t be the first to come up with the first method. Hehe.

10 Likes

Ooh yeah, I’ve used this method before to make my force-close project last year:

https://c.gethopscotch.com/p/xsc93b66c

Thanks for making this topic - it’s a really great technique to know of for sure. :D

7 Likes

Oooh yes it did use to crash the app! I have been able to use it recently, I think they had fixed that up

5 Likes

What’s interesting to me about this project is that when you run it multiple times, each time it will be more and more prone to crashing. It’s as if the CPU decides to dedicate more RAM to the app because it noticed an overload in a previous session of the app… intriguing. :o

5 Likes

34 posts were split to a new topic: Repeat Until / Wait Until block request

Separated this workaround from the feature request, so that it is more visible for Hopscotch Team

Moving discussion related to merging!

Moving discussion related to merging!

you can’t exit hopscotch: panik
you realize that you have this project: kalm
you realize you have a good device: panik

2 Likes

bump

@Yuanyuan this could be a cool block, and would help a lot.

1 Like

yeah, @yuanyuan, i’d love this to be a feature.

1 Like