Skip routine using routine flow settings

How is the “Skip if” option in the flow tab of the routine settings meant to be used?

I have previously made a code component for every routine that just checked a “skiptoend” variable and skipped if = 1. This variable is initialized in the “before experiment” tab of the first routine, and is set to 1 based on the participant’s response in the first routine. I don’t really want to make a code component just for this on every single routine for the rest of the experiment.

In the routine settings, in the “Flow” tab there is a “Skip if…” option. But when I try to use this, it says that I am referencing the variable before assignment. How is this option meant to be used? Is there a way to set this variable even earlier in the experiment?

Update: Instead of setting skiptoend to 0 “before experiment” and setting it to 1 and the end of a particular routine, I also re-set it to 0 at the end of that routine. Weirdly that fixed it.

You shouldn’t use Before Experiment for anything other than defining functions and running code that needs to run while the dialogue box is showing. Most setup code goes in Begin Experiment.

1 Like