Making a loop repeats itself

Hey! :grinning:

I’m trying to make the loop named repLoop to repeat itself eveytime someone clicks a button in repeatRoutine.
So far, I tried to create a variable that will be increased (+1) on every click and put it in the nReps of the loop’s properties. Also, I tried repLoop.nReps+=1. Althought the value of the variable and the nReps has been increased, it didn’t change the number of times the loop repeated itself.

I would be gald to get some help.
Thanks!

Hi @Ido1122,

I would do it the other way around. Set nReps really high and then use repLoop.finished = True as soon as the loop repeated iteself as often as you want it to.

Hey,
It’s very clever. I tried it that way and it’s probably the best way to implement the idea. I also looked into some posts in the past and also saw that there is no way to change the nReps when a loop begins.

Thank you! :grinning: