This function creates a "while loop" in the participant's testing session. This "while loop" corresponds to the following procedure:

  1. Check whether a condition (termed test) is satisfied.

  2. If the condition is satisfied, execute a series of test elements (termed logic), otherwise exit the while loop.

  3. Loop back to step 1.

while_loop(test, logic)



Test function to execute. Argument list should include ...; further permitted arguments are: state, the participant's state object; input, the Shiny input object for the current page; output, the Shiny output object for the current page; session, the Shiny session object; opt, test options as created by test_options().


List of psychTestR test elements.


The previous version of this function, loop_while, always executed the series of test elements at least once, even if the condition was never satisfied.