Icon

6. Loop on Condition

<p><strong>Loop on a Condition</strong></p><p>This workflow implements an example of a loop on a condition using the <em>Variable Condition Loop End</em> node. This means, the loop stops only when a certain condition is met which is defined in the <em>Variable Condition Loop End</em> node.</p><p>Let's imagine the following game:</p><p>We think of a number an write it into the <em>Table Creator</em> node. Then we start the loop with a <em>Generic Loop Start</em> node. In the loop, we prompt the user to guess the number we have thought of. They can write their guess into the <em>String Widget</em> node. If the answer is wrong, the user is prompted again until the answer is right OR he has already tried 3 times. The condition is built by the <em>Variable Expression</em> node and represented by the flow variable "success" (0 if guess is wrong, 1 if guess is right OR when the number of iteration is 3). The <em>Variable Condition Loop End</em> node then ends the loop under the condition when "success" equals the value 1.</p><p>This workflow should be executed as a Data App on the KNIME Hub since there the <em>Widget </em>node makes the workflow stop to collect the user guess at each iteration.</p>

Nodes

Extensions

Links