Icon

Exercise 1

<p><strong>Chapter 8/Exercise 1</strong></p><p>In this exercise, we implement a CASE Switch block within a loop.</p><p>We first generate numbers from 1 to 10 with the <em>Table Creator</em> node. We then process the numbers, however, we want process the numbers differently: Multiply even numbers by 3 (top branch) and odd numbers by 10 (bottom branch).</p><p>To identify whether a number is even or odd we implement a modulo operation using the <em>Expression </em>node. We then process the data row by row using a <em>Table Row to Variable Loop Start</em> node. To process the even and odd numbers accordingly, we implement a CASE Switch block inside the loop, activating either the top port if the number is even, or the bottom port if the number is odd. The <em>Loop End</em> node collects the results of each iteration.</p>

Nodes

Extensions

Links