How can I use a repeat loop in App Inventor?

image

Please provide more information on your question/concern, loop itself used to repeat things, but by repeat loop, do you mean to have nested loop?

See

1 Like

Hello user, welcome to the community!
Before making a post, please follow these instructions:

2 Likes

This book chapter should help:
http://www.appinventor.org/bookChapters/chapter20.pdf
from
http://www.appinventor.org/book2
from

Also see the Clock Timer event, for visible looping over longer periods of time.

1 Like

you can use this way:
first ad the clock


uncheck "TimerEnabled" and set Timerlnterval to the time you want the app to wait between any repeat.
check TimerAlwawsfires if you want the loop to work even if the app is minimized.
برنامه نویسی اندروید 11_10_2021 6_54_02 PM
now use these blocks to start the loop:blocks (1)
use this block to say the app what to repeat:component_event
to stop the loop, use these blocks:

Don't set the TimerInterval to 0ms, since this invalidates its use; you could use while/for instead. I believe @ABG's post qualifies it to be higher (at least 1000ms or more)...

Moreover, setting it to 0ms doesn't account for the processes taking place inside of the loop; which at least would take around ~5-6ms on a moderate phone. Ergo, it would overlap.

Really? Where?

How to make a dice roll 1000 times

Just by looping over the get random from list block 1000 times, as it is done for once in code below,

Don't forget to record the outcome of each trial.

Something similar you might be interested in

1 Like