Using While Condition

Using While Condition

To use the While condition, follow the steps given below.

  1. Open the required workbook or create a new workbook. The selected workbook canvas is displayed.
  2. Add the reader/dataset if not already present in your workbook.
  3. Drag-and-drop or double-click the While node from Condition into the workbook canvas.

To create a workbook using the While loop, follow the steps given below.

  1. Connect the reader to the While node.
  2. Drag-and-drop or double-click the desired algorithm into the workbook canvas. Refer to Building Algorithm Flow in a Workbook Canvas.
  3. Connect the While node to the algorithm.
  4. Connect the algorithm node to the End node.

    (info)
    Note
    :

    The algorithms should always be inserted between the Condition and the End node.

  5. Click the While node and select the Properties displayed on the right-hand side. Refer to While Condition Properties
  6. Click the algorithm node and select the Properties displayed on the right-hand side. Refer to Understanding the Algorithm Properties.
  7. Click the End node and select the Properties displayed on the right-hand side. Refer to End Properties.
  8. Click the Save icon () on the Function Pane of the workbook to save the workbook.
  9. Click the Run icon () on the Function Pane of the workbook To run the workbook. A sample workbook using the While loop is shown below.


The algorithm connected to While is executed until the While condition is true.

While Condition Properties

The While Condition Properties show Task Name fields and Clause fields associated with it.


The table given below describes the functions present on the While condition.

Field Name

Description

Remarks

Task Name

It is the name of the condition selected (While).

While Tasks

It lets you select the successor algorithms which are executed while the condition evaluates to True.

Clause

It lets you create a complex condition.

You can add more than one clause.

Clause



Parameter

It lets you select the variable for the condition.

  • Refer to Adding a Variable.
  • Although you can use any type of variable, it is recommended to use only numerical variables in the While condition.

Condition

It lets you select the mathematical operator for your variable.

Value

It lets you enter the required values to test or execute the successor algorithms connected to the While condition.

This value is compared with the Current Value of the added variable to evaluate the expression.


(info)Notes:

  • Rubiscape currently supports only the value of the variable to be incremented by one. So, make sure that the Condition and the Value selected are equal to or greater than the current value.
  • The value is incremented internally and does not reflect in the current value of the variable.


The figure given below is an example of While Properties. The selected condition is While, and the successor algorithm selected to execute the While condition is Decision Tree.


In the example above, the newly added variable is Test1 with the Current Value as 10. The While condition is Test1 <12. In this example, the Decision Tree algorithm is executed twice until the current value of Test1 is less than 12. In the third iteration, the current value becomes 12, the while condition fails at this point, and the execution stops.


    • Related Articles

    • Using While Condition

      To use the While condition, follow the steps given below. Open the required workbook or create a new workbook. The selected workbook canvas is displayed. Add the reader/dataset, if not already present in your workbook. Drag-and-drop or double-click ...
    • Using While Condition

      To use the While condition, follow the steps given below. Open the required workbook or create a new workbook. The selected workbook canvas is displayed. Add the reader/dataset, if not already present in your workbook. Drag-and-drop or double-click ...
    • Using If-else Condition

      To use the If Else condition, follow the steps given below. Open the required workbook or create a new workbook. The selected workbook canvas is displayed. Add the reader/dataset, if not already present in your workbook. Drag-and-drop or double-click ...
    • Using If-else Condition

      To use the If Else condition, follow the steps given below. Open the required workbook or create a new workbook. The selected workbook canvas is displayed. Add the reader/dataset, if not already present in your workbook. Drag-and-drop or double-click ...
    • Using Filters

      When you plot a chart, all the data in the dataset is not required to be used. Also, within the data used, there might be sub-categories that you want to plot separately. You can view classified results in the charts using filters. Filters help you ...