Dynamic Loop

In this chapter we are going to create the Dynamic Loop sample

Introduction

We can create this program quickly using the Quick Start component

ib_quickstart_dynamicloop.png

Program Steps

After selecting the (Dynamic Loop) template, we will get the next steps in the Goal Designer

gd_quickstart_dynamicloop.png

Creating the Program

To create this program we will use the next components

  • Print Text

  • Get Input

  • Assignment

  • For Loop

Note

This example uses the Assignment component to convert Strings to Numbers, but we can just let the Get Input component do the conversion for us.

In the begining the Steps Tree is empty

1.png

Select the (Print Text) component

2.png

Enter the data in the Interaction Page

Text: Start :

Type: Literal

3.png

The Steps Tree will be updated

4.png

Select the (Get Input) component

5.png

The variable name will be (nStart)

6.png

The Steps Tree will be updated

7.png

Print (End : )

8.png 9.png 10.png

Use the (Get Input) component

11.png

The variable name will be (nEnd)

12.png

The Steps Tree will be updated

13.png

Print (Step : )

14.png 15.png 16.png

Use the (Get Input) component

17.png

The variable name will be (nStep)

18.png 19.png

Convert the variables (nStart, nEnd and nStep) from String to Number

Use the (Assignment) component

20.png

Convert the variable (nStart) from String to Number

21.png 22.png

Use the (Assignment) component

23.png

Convert the variable (nEnd) from String to Number

24.png 25.png

Use the (Assignment) component

26.png

Convert the variable (nStep) from String to Number

27.png 28.png

Select the (For Loop) component

29.png

Enter the data in the Interaction Page

Start: x = nStart End: nEnd Step: nStep

30.png 31.png

Use the (Print Text) component to print the number

32.png 33.png

Now we have the final Steps Tree in our program

34.png