Branch Function

The branch function is a unique function in FlowForge, because it does not have any external output points. Rather, it has two output points and only one of them can be executed

If you have done any programming, you may have realized this is basically an if-else statement. In Java, this would be similiar to :

if (condition == true) {
    System.out.println("Condition is true!");
} else {
    System.out.println("Condition is false :( ");
}

For non-programmers, don't worry. You will learn more about this in this lesson.

1. Creating a boolean node

First, head to the variables section and create a new Boolean node. You can name it anything. The boolean node will be used to operate the Branch Node

2. Connecting it to the Branch Node

Now, we will use a branch Node.

  1. Connect the Start node to a new branch node

  2. Connect the Start node's Output-X to the boolean's "Set" point (input-X)

  3. Connect the boolean to the branch node's "Condition" point (Output-X)

As shown above

3. Using the "True" and "False" Output points

Now,

  1. Place two Print nodes in front of the branch node

  2. Connect the "True" Output point to one Print node

  3. Connect the "False" Output point to the other Print node

As of FlowForge v1.5, Dynamic connections do not apply to Branch Nodes.

The blue line represents True while Red line represents false

4. Executing the program

When we feed the boolean condition to the branch node, the branch node evaluates it. If the boolean value is true, the nodes connected to the "True" output point will be executed. If the boolean value is false, the nodes connected to the "False" output point will be executed

Now when you run the program, you will see the following output :

This is because the value of our condition boolean node is set to false by default. To change it to true, simply click on the checkbox on the boolean node

Now when we run again :

Voila! Now the node connected to the True output point was executed.

Last updated