Main Content

While Loop

Iteratively execute child components while a specified condition is true

Description

This component iteratively executes its child components while a specified condition is true. The While Loop component must have at least one child component; the purpose of this component is to run its children several times. If it does not have any children, this component does not add anything to the report.

Tip

Limit the number of repetitions to prevent infinite loops.

Logic Properties

  • Continue looping if this expression is true: Specifies an expression to evaluate. This expression must be a valid MATLAB® expression that evaluates to 1 or 0 (true or false).

    For example, if a = 1, b = 2, and c = 3, the following command:

       d=(a>b/c)
    
    returns:
       d = 1
    
    Because 1 is greater than b/c (2/3), this expression is true and evaluates to 1.

  • Limit number of loops to: Allows you to prevent infinite loops. Use the left and right arrows to increase or decrease the number of loops.

  • Initialize with this expression: Initializes the loop with a valid MATLAB expression.

Insert Anything into Report?

Yes, if it has a child component.

Class

rptgen_lo.clo_while