Timer Repeat Until Switch screen or indefinitely


Working on app to make images loop on the screen. Ideally want it to repeat indefinitely until user switches screens. However, can’t seem to figure out how to make it repeat indefinitely using the timer functions.

Here’s the link: App Lab - Code.org

any advice is appreciated.


I think you may be off to a good start … What if you tried using the modulo operator (%)
to determine which photo to display. If you aren’t sure how that works, modulo is a fancy word for the remainder of a division problem… Here’s more information on that.

To use that in your code, here is some example pseudocode …

You use the count variable like you are, but then use a modulo expression like this:

IF (COUNT % 3 == 0) {… hide image 3, show image 1}


IF (Count % 3 ==1) {… hide image 1, show image 2}


If you were to do that, no matter what the count is, the resulting calculation will always be 0, 1 or 2 as those are the only possible remainders when dividing by 3.

Hopefully this helps, but if not, feel free to check back in!


1 Like

Hi Mike-

I was using the Mod operator in the previous version and now realize that my boolean expressions w/ the mod op were incorrect so now it works…I also assumed that the timedLoop() only executed 1x vs indefinitely but now that my boolean expressions are correct I see that it repeats indefinitely…thanks for the tip!

1 Like