| Reference | Downloads | Github

Conditional Loop Skip


I have an experiment wherein I would only like the participant to be able to progress should they not complete the task.

I currently have the following:

nReps in SkipLoop are set to SkipReps

In the Stimuli Routine I have a code block. In Begin Routine it has:

press = response.getKeys()
SkipReps = 0

In the StimCorr Routine I have a code block, in Each Frame it has:

for thisKey in keys:
if thisKey == ‘3’:
SkipReps = 1
SkipReps = 0

The experimenter responds with 3 to show it was incorrect, which I was hoping would then go into the SkipLoop and show another stimuli, however I am instead getting “SkipReps is not defined”.

I was originally trying to get it to work without the need for an experimenter response, wherein after a certain amount of time it would record that there was no key press, and again go into SkipReps, but I couldn’t grasp the coding to do this.

Any help would be most appreciated!

You can’t change SkipReps while you are inside SkipLoop

Instead you should put nReps for SkipLoop to the maximum number of repeats you might need and then use SkipLoop.finished=True when you want to break out early.