Navigation stuff goes here


Command groups: if

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:

if $varLastAnswerCorrect is no [… some steps here …] end if

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:

if $lastClick is Q call doThisIfTheyQuit else if $varLastAnswerCorrect is yes call youGotItRight else if $varTellThemWhenTheyGetItWrong is yes call youGotItWrong else -- they got it wrong but don't tell them call uninformativeResponse end if

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.

Commands

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

Technical notes

See also