# Repeat trial loop until a condition

**URL:** <https://discourse.psychopy.org/t/repeat-trial-loop-until-a-condition/25497>\
**Category:** Coding\
**Created:** [October 19, 2021, 7:22pm UTC](https://discourse.psychopy.org/t/repeat-trial-loop-until-a-condition/25497 "2021-10-19T19:22:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TaliaRoman](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@TaliaRoman](https://discourse.psychopy.org/u/TaliaRoman)\
**Post date:** [October 19, 2021, 7:22pm UTC](https://discourse.psychopy.org/t/repeat-trial-loop-until-a-condition/25497/1 "2021-10-19T19:22:46Z")

</div>

Hi everyone,

I have a very simple experiment, I just want that trials (which are practice trials repeat until participants reach 80% of correct responses). I know I need a code component but I’m really naive, I don’t know if I have to put it in the trial routine, in such a case I don’t know if I have to select end routine or end experiment and I don’t know what I have to specify in the code itself.

I know it’s very basic but I wish somebody can help me, thank you

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/c/1/c16e8d34a8b92fe93122f9463f5a0c5dc8442640.png)

---

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [October 21, 2021, 2:05pm UTC](https://discourse.psychopy.org/t/repeat-trial-loop-until-a-condition/25497/2 "2021-10-21T14:05:01Z")

</div>

See if there’s anything helpful here: [Conditional loop depending on percentage of correct responses](https://discourse.psychopy.org/t/conditional-loop-depending-on-percentage-of-correct-responses/4003)
