Skip to content

How to Inject Logic

Experiments Surveys & forms

Testable lets you add conditional branching to any trial sequence using the **`if`** and **`then`** columns. When the condition in `if` is met Testable executes the instruction in `then`; otherwise it moves to the next row.
ColumnValue
ifA condition to evaluate
thenWhat to do when the condition is true

Both columns must be on the same row. If either is blank on a row, logic is not applied to that trial.

ConditionMatches when
correctParticipant responded correctly
incorrectParticipant responded incorrectly
RT > 500Reaction time was greater than 500 ms
RT < 300Reaction time was less than 300 ms
response = catParticipant’s response text equals cat
responseCode = 2Participant selected the second option

Prefix a condition with ! to invert it:

if = !correct

Use & to require multiple conditions simultaneously:

if = correct & RT < 500

Use has() to check whether the response contains a substring:

if = response has(cat)

Separate multiple condition–action pairs with ; on the same row to evaluate them in sequence:

if = correct; RT < 300
then = end; +1

The first condition is paired with the first then value, the second with the second, etc.

DestinationGoes to
30Trial file row 30
trialAThe trial labelled trialA in the label column
+2Two rows forward from the current row
-1One row back
endSkip to the end of the experiment
screenoutRemove participant from the study (screener mismatch)
https://example.comRedirect participant to an external URL

Use the label column (an organisation column) to give a row a name, then reference it in then:

label = startBlock2
...
then = startBlock2

This is more maintainable than hard-coding row numbers, which change when you add or remove rows.

label = practiceStart
...
if = incorrect
then = practiceStart

If the participant responds incorrectly they are looped back to the start of the practice block.

if = correct & RT < 400
then = +3

If the participant was both correct and fast, skip 3 rows to a harder condition.