Initite a condition loop

Hello everyone, im trying to make a loop over a few routine by a condition. i want generte a loop with same logic as a while loop over few routines. at the last routine of the loop im asking a question ,if the answer is 1 - do the loop again (and basicly every time the answer is 1 do the loop again’ in theory can get to an infinite loop but obviously wouldnt happen in a real time experiment. if the answer is 2, finish the loop and go to the next routine.

Hi There,

As you mention “routines” it sounds like you might be trying to do this in Builder (which I would recommend). I would suggest using a loop with a large number of repeats and end the loop using a code component like the below:

if 'y' in key_resp.keys:
    kind_of_while_loop.finished = True

Attaching a psyexp file here to help.

Becca
loop_example.psyexp (13.5 KB)