How to break a loop if a certain condition is met

What are you trying to achieve?: So I have a nested loop (the picture above) in my experiment. The inner loop has three conditions. I wanna be able to skip the other 2 or 1 condition when the correct response is received for the first or second condition, respectively. I figured out the ‘if’ line of the code component after going through the python script but i am not able to figure out how to break the inner loop once.

What did you try to make it work and what specifically went wrong when you tried that??: i tried continueRoutine=False but it didn’t work (I didn’t expect it to) i also tried a simple break and that just caused the experiment to be stuck on the same routine on loop.

This is what my code component currently looks like
if ANS == textbox.getVisibleText():

I’m a beginner and any help would be greatly appreciated!!

Hi There,

To end a loop you can use loopname.finished = True

Here are some working examples.

Becca