# Delay Step

This function block delays the incoming signal by one execution step. It outputs the previous value received on the `Input` socket and updates its internal memory with the current input for the next run. Use this block when you need a one-step lag in signal processing or to break immediate feedback loops.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Input` — Generic input signal to be delayed. Accepts any data type.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Output` — The value provided at the previous execution step. On the very first run this may be empty (no previous value).

## 🕹️ Controls <a href="#controls" id="controls"></a>

No interactive controls or widgets for this block.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

On each execution cycle the block:

* Returns the value it stored from the previous cycle via `Output`.
* Replaces its stored value with the current `Input` for use on the next cycle.

This behavior creates a stable single-step delay between input and output without modifying the signal content.

## 🎯 Features <a href="#features" id="features"></a>

* Simple, reliable one-step delay for generic data.
* Useful for creating temporal relationships between signals.
* Helps break immediate feedback loops in graphs that require sequential state updates.

## 📝 Usage instructions <a href="#usage" id="usage"></a>

1. Connect any signal-producing block to the `Input` socket.
2. Use the `Output` where you need the previous-step value.
3. If the first-run empty value is not acceptable, handle it with a block such as `Replace None` or conditionally initialize upstream data.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Combine with `Edge Rising` or `Edge Falling` to detect transitions with one-step history for debouncing or sequence detection.
* Use with `Set - Reset` or `Counter` to build simple state machines or counting logic that requires previous-state information.
* Insert before logical blocks like `And` / `Or` when you need aligned timing between multiple signals.
* Use alongside `Data Memory` or `Data Write Local` / `Data Read Local` when building more complex stateful systems or when you need to preserve values across multiple steps or subsystems.
* Place before `Demux` / `Mux` or `Batch Processing` when delaying composite data structures to keep sequence alignment.
* If your workflow uses human toggles, pair with `Logic Input` to create manual step timing with one-step history.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* Output appears empty on first run: this is expected. To avoid issues, initialize upstream data or use `Replace None` to substitute a default.
* Signals seem out of sync: remember that outputs are always one execution step behind inputs. Ensure other blocks in the flow are aligned or introduce additional `Delay Step` blocks where needed.
* Unexpected feedback loops: use this block to break immediate cycles; placing a single-step delay often resolves stability and ordering problems.
