This structure allows you to do a number of different things depending on the values of variables. It can be used with pre-defined variables like $lastClick, and with user-defined variables like $varCorrectAnswer. The simplest form is a single test:
but the form can involve as many tests as you want, optionally ending in an else clause with no condition, which will be triggered when all the tests are false:
The four conditions you may use are
<value1> is <value2>
<value1> is not <value2>
<value1> is in <value2>
<value1> is not in <value2>
is tests to see whether the two values are identical. is in tests to see whether the first value is a substring of the second value.
if condition
[…]
end if
Makes PsyScript perform the steps between the if and the associated end if only if the condition is true.
if $lastAnswer is q
if I is not in $varAnswersSoFar