while_loop: While loop

while_loopR Documentation

While loop

Description

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.

Usage

while_loop(test, logic)

Arguments

test

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().

logic

List of psychTestR test elements.

Note

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.


pmcharrison/psychTestR documentation built on Nov. 10, 2024, 9:03 p.m.