Reply To: Conditionals/display logic

PennController for IBEX Forums Support Conditionals/display logic Reply To: Conditionals/display logic

#6167
Jeremy
Keymaster

Hi August,

Yes, it is possible. You’ll have to use a global Var element to store and retrieve the participant’s answer to the previous trial. Then depending on its value you either run the full next trial, or you skip over it. Here’s a basic example:

newTrial(
    newText("How many inches in a foot?").print()
    ,
    newScale("answer", '10','11','12','13','14').button().print().wait()
    ,
    newVar("inches").global().set(getScale("answer"))
)

newTrial(
    getVar("inches").test.is(12).failure(
        newText("How many centimeters in a meter?").print()
        ,
        newScale("answer", '10','100','1000').button().print().wait()
            .test.selected(100).success( newText("Good job!").print() )
            .failure( newText("Oh well, better luck next time").print() )
        ,
        newButton("Next").print().wait()
    )
)

newTrial(
    newText("This test is over!").print()
    ,
    newButton().wait()
)

Let me know if you have questions

Best,
Jeremy