Summary

This section explains how to use If \ Else to spread execution, as well as execute maps in Loops.

Conditions are an important factor in any development language when dealing with If \ Else and Loops. Kaholo makes no exception to this rule, and grants the ability for adding conditions to your process execution.

If \ Else

In this example of an If \ Else condition, we created a condition within each Process.

 

In the code we entered:

 let i = 0 

Upon saving and executing the map, you can see that only the helloCode process been executed.

The blue font color indicates that the process didn’t pass the condition.

Loops

A loop causes a process to be executed repeatedly.  To create a loop, all you need to do is start with a simple design,  draw the loop, and add a condition.

  • Under the Flow Control tab, set the “Process Coordination” to “run for each in link” from the drop-down menu.

  • Add a Pre Hook function.

 

Implement the code as follows:

 let i = 0;
function doCondition() {
   i++;
}

Another way to establish the condition is to replace the function code of the hook with ‘i++’, which will work the same way.

 

Next, save the map and execute.

Adding a Mandatory Condition

Under the Conditions tab, ticking the checkbox for the Mandatory Condition option will cause the map to stop the execution if  the process does not pass the corresponding condition.

 

 

Close Menu