# Multi Port Switch

This function block provides a mechanism to switch between various input sources based on a reference number. It allows users to dynamically choose from several inputs.

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

`Switch` A number used to determine which input to output.

`Input 0` The first possible input connection.

`Input 1` The second possible input connection.

Additional input connections can be added, allowing you to switch up to 20 inputs based on the selected switch number.

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

`Generic` This output provides the selected input based on the switch value.

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

`Number of inputs` A dropdown menu that allows you to select the total number of inputs available for the switching operation.

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

`Dynamic Input Switching` Users can easily change the input source being utilized during runtime.

`Customizable Inputs` The number of available input sockets can be adjusted dynamically based on user selection.

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

1. **Select Number of Inputs**: Use the dropdown to set the number of inputs you want to work with, ranging from 2 to 20.
2. **Connect Inputs**: Link your desired input sources to the appropriate input sockets (`Input 0`, `Input 1`, etc.).
3. **Set Switch Value**: Provide a number through the `Switch` input to determine which of the inputs should be output.
4. **Evaluate**: Run the block to examine the output from the chosen input based on the switch value.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When executed, the block will output the data from the input corresponding to the value provided on the `Switch`.

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

<details>

<summary>Dynamic Control</summary>

You can create interesting scenarios where only specific inputs are activated based on conditions. For example, use blocks that provide the switch number based on certain criteria.

</details>

<details>

<summary>Combining with Logic Blocks</summary>

Integrate this with `Logic Operations` to provide more complex switching scenarios where multiple conditions can control input selection.

</details>

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

<details>

<summary>Invalid Input Connections</summary>

If you encounter issues where the output is not as expected, ensure that the `Switch` value actually corresponds to a connected input. If the selected input is not connected, the block will indicate an invalid state.

</details>

<details>

<summary>Exceeded Number of Inputs</summary>

Ensure that the switch value does not exceed the number of inputs you have defined in the dropdown. If it does, it will return `None` as the output.

</details>
