# Sequential

## Overview

![](https://2631170186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MIspkFTPkuGkv4UgQGs-887967055%2Fuploads%2Fgit-blob-8fb4596014f6daec568ba50df0f3cfe054dfc02c%2Fnode-sequential.png?alt=media)

The **Sequential Node** generates a user-defined number of **Output Pulses**, and executes their **Logic** sequentially (one after the other), with the top-most **Pulses** being executed first. The one caveat to this is, that if any **Nodes** that pause, or delay the flow of **Logic** are used, they will only affect that particular **Branch**, not the other **Output Pulses** (See **Execution Order** below).

They are commonly used to organise **Logic** in a more readable way, or to execute multiple actions independently of one another.

## Examples

In all of the examples below, the results are the same. We are simply setting four icons to be invisible. What's different is how this **Logic** is *implemented*.

Normally, **Logic Branches** execute from left-to-right, and all **Nodes** are *connected* to each other, even if they aren't directly *related* to each other. This can not only *imply* that they are dependent on each other, but if for some reason, part of the **Logic** fails or is incorrect, subsequent **Nodes** may never be executed, meaning that the execution of each **Node** is *actually* dependent on the successful execution of its preceding **Node**.

![](https://2631170186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MIspkFTPkuGkv4UgQGs-887967055%2Fuploads%2Fgit-blob-4315582ed602cc3cace2b2289fcb6080c773c8cf%2Fsequential-problem.png?alt=media)

By using a **Sequential Node**, we can list these individual execution orders as separate, independant **Branches**. This solves our dependance problem, and visually shows that they are separate actions.

![](https://2631170186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MIspkFTPkuGkv4UgQGs-887967055%2Fuploads%2Fgit-blob-57ca31caa4a481957a3dd6e0fce4d5877f5e6ce1%2Fsequential-solution.png?alt=media)

In this particular example, a better solution would be to combine the **Sequential** and **SelectData Nodes**, to perform the same action on multiple **Objects**.

![](https://2631170186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MIspkFTPkuGkv4UgQGs-887967055%2Fuploads%2Fgit-blob-3a8b3945147c1b84bad6892f04fbd4e7e2ea011d%2Fsequential-better.png?alt=media)

## Attributes

| Attribute     | Type    | Description                                                            |
| ------------- | ------- | ---------------------------------------------------------------------- |
| `Pulse Count` | **Int** | The number of **Output Pulses** that will be executed in the sequence. |

## Inputs

| Input             | Type      | Description                                                           |
| ----------------- | --------- | --------------------------------------------------------------------- |
| *Pulse Input* (►) | **Pulse** | A standard **Input Pulse**, to trigger the execution of the **Node**. |

## Outputs

| Output      | Type      | Description                                                                                                                                  |
| ----------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `Pulse [n]` | **Pulse** | A **Pulse** which is executed sequentially from top-to-bottom. The total number of **Pulses** is defined in the `Pulse Count` **Attribute**. |

## Execution Order

Here, we output three written numbers to the console, using the **Sequential Node**. As you might expect, the numbers are show immediately after each other, in the correct order:

![](https://2631170186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MIspkFTPkuGkv4UgQGs-887967055%2Fuploads%2Fgit-blob-6d2d8705e9206a28f8ebb17b71f527a631b4fdae%2Fsequential-execution-order-normal.png?alt=media)

```
One   [0 seconds]
Two   [0 seconds]
Three [0 seconds]
```

No, when we add a **Timeout Node**, which delays the execution of **Branch**, you might expect the numbers, to be output in order, with a delay between "One" and "Two". This, however, is not the case, as **Timeout Nodes** only affect the **Branch** that they're on. You will instead see the following output, exactly as before.

![](https://2631170186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MIspkFTPkuGkv4UgQGs-887967055%2Fuploads%2Fgit-blob-dd269502c509bc2de8d164aa7e79fcad67741efc%2Fsequential-execution-order-timeout-01.png?alt=media)

```
One   [0 seconds]
Two   [0 seconds]
Three [0 seconds]
```

This becomes much clearer, when we insert a **Timeout Node** *before* the **Console Node** is executed. Now we see that "Two" and "Three" are shown immediately, while there is a delay before "One" being shown.

![](https://2631170186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MIspkFTPkuGkv4UgQGs-887967055%2Fuploads%2Fgit-blob-821957c8fbaa47ac6c65575132c8d34548dac55a%2Fsequential-execution-order-timeout-02.png?alt=media)

```
Two   [0 seconds]
Three [0 seconds]
One   [1 second]
```
