This is an old revision of the document!


PHP's gd library is missing or unable to create PNG images


LESSON 13: Loop structures on Dinamica EGO



Dinamica EGO has several looping structures that can be used for various applications.

Loops are handy, if you want to run the same code over and over again, each time with a different value. Loops can execute a block of code a number of times.

What will you learn?

  • Different Kinds of Loops on Dinamica EGO and how to work with Repetition structures.



Container operators that repeat the functions within them:





Repeat: This container makes a set of functors, linked in a dataflow chain, iterate a number of times

For: This container makes a set of functors, linked in a dataflow chain, iterate a number of times.

For each: This container executes the contained functors once per each element of a given lookup table.

For each category: This container executes the contained functors once per each class or category of a categorical map specified as input.

For each region: This container creates and manages regions identified by a categorical map, whose classes represent regions. It manages both the processes of splitting a map into several maps, each one comprising a region, and the subsequent merging of all regional maps in a mosaic, that is a new map. The container also calls the functors inside it to each region.

While: Checks the condition at the starting of the loop and if the condition is satisfied statement inside the loop, is executed.

Do while: The condition is checked after the execution of all statements in the body of the loop.

Auxiliary operators to control iterations:





Step: This functor receives and passes on the current model step or iteration.

Mux Map: This functor makes a map dynamic, feeding it back with a map output from a model step. In the beginning of the first iteration, it reads map input from the initial port.

Mux Table: This functor makes a table dynamic, feeding it back with a table output from a model step. In the beginning of the first iteration, it reads the table input from the initial port.

Mux Value: This functor initiates and feeds back a loop variable containing a value. In the beginning of the first iteration, it reads the input value from the initial port.

Congratulations, you have successfully completed this lesson! Now let’s move to the next lesson: LESSON 14: Using "For" to make successive calculations