Steps can be connected to other steps via connections that affect how execution flows between steps. Consider the simple robot below:
This robot consists of three steps named "step A", "step B", and "step C". Assuming that no errors occur, and that each step generates exactly one output robot state, the robot is executed as follows: An initial robot state will be generated and used as input to step A (being the first step). Step A will produce an output robot state. This output robot state will be the input robot state of step B. Similarly, step B will produce a robot state and this will be the input robot state of step C. Once step C has executed and produced an output robot state, execution completes. In short, the execution of steps can be described as follows: "A, B, C".
Sometimes, a step generates no output robot state when executed. This happens when an error or a test step causes execution to continue somewhere else in the robot, and it is described in the section on Conditions and Error Handling.
Steps containing a loop action may process the input state several times, each time outputting a distinct robot state. Consider the robot below where step B contains a loop action:
Assuming that there are no errors or test steps, that step B outputs three robot states, and that all other steps output exactly one robot state, then the steps will be executed in the following order: "A, B, C, D, B, C, D, B, C, D", where B[N] refers to the Nth iteration of the loop action contained in step B. Note that the output robot states by step B will be different robot states — that is, each iteration will output a new robot state. Hence, step C will receive a new input robot state each time it is executed.
A step can connect to more than one step. This is called branching. Consider the robot below:
In this robot, step A is followed by a branch point, where the connection splits out in two branches. One branch consists of step B and step C, and another consists of step D and step E. All of the branches coming out of a branch point are executed, one after another. Therefore, assuming that no errors or test steps change the control flow and that each step generates exactly one output robot state, then the robot above will be executed as follows: A, B, C, D, E. However, it is important to note that step B and step D will each receive a copy of the same output robot state produced by step A.
Branches can merge, and in complicated ways. Consider the following robot:
This robot illustrates how connections can be explicitly ordered. In this robot the branches of step D are executed in the order specified by the numbers, that is, step E is executed before step C. If an order is not specified (by numbers), connections are executed top-down. Thus, assuming that there are no test steps, that no errors occur, and that each step generates exactly one output robot state, the robot is executed as follows: A, B, C, D, E, C. The first time step C is executed it will receive the output robot state produced by step B; the second time step C is executed it will receive the output robot state produced by step D.
Sometimes you want to select (i.e. execute) only one of several branches, depending on circumstances. The following section shows how to do this.