> ## Documentation Index
> Fetch the complete documentation index at: https://docs.odella.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Race Inputs Block

> Handle multiple inputs and output the value of the first input to finish

<Frame>
  <img src="https://mintcdn.com/odella/PGZ7enNCqh0mvwj_/block-reference/assets/race_inputs_light.png?fit=max&auto=format&n=PGZ7enNCqh0mvwj_&q=85&s=497f1c6ec0d2427e08984426d8176e91" alt="Race Inputs Block Screenshot" className="block dark:hidden" width="822" height="256" data-path="block-reference/assets/race_inputs_light.png" />

  <img src="https://mintcdn.com/odella/PGZ7enNCqh0mvwj_/block-reference/assets/race_inputs_dark.png?fit=max&auto=format&n=PGZ7enNCqh0mvwj_&q=85&s=56a37be88a2c53de834150bd36b607b7" alt="Race Inputs Block Screenshot" className="hidden dark:block" width="876" height="272" data-path="block-reference/assets/race_inputs_dark.png" />
</Frame>

## Overview

The Race Inputs Block is used to handle multiple inputs and output the value of the first input to finish, force-cancelling the other inputs. This block is particularly useful when you have multiple operations that can potentially fulfill the same requirement, and you want to use the result of the operation that finishes first.

## Key Features

* Dynamically creates input ports based on connections
* Outputs the first completed input value
* Cancels remaining inputs after first completion
* Hidden by default in the block menu
* Belongs to the Logic group

## Inputs

<ParamField path="Input [i]" type="any">
  The ith input to be raced. The number of inputs is dynamic based on the connections made to the block. Each input port is labeled as "Input 1", "Input 2", etc.
</ParamField>

## Outputs

<ResponseField name="Result" type="any">
  The value of the first input to finish. If no inputs finish or all inputs are control-flow-excluded, this output will be control-flow-excluded.
</ResponseField>

## Editor Settings

<ParamField path="Hidden" type="boolean" default={true}>
  Whether the block is hidden in the block menu. This block is hidden by default.
</ParamField>

<ParamField path="Width" type="number" default={300}>
  The width of the block in pixels.
</ParamField>

## Example: Race two Chats

1. Create a new flow and add two Chat Blocks.
2. Add a Prompt Block with a quick-to-answer prompt like "What is your favorite color?" Connect it to the first Chat Block's `Prompt` input.
3. Add another Prompt Block with a longer prompt like "Describe in detail the story of Hamlet." Connect it to the second Chat Block's `Prompt` input.
4. Connect both Chat Block outputs to a Race Inputs block.
5. Run the flow. The first Chat will finish quickly, and the Race Inputs block will output its response. The second Chat Block gets canceled.

## Error Handling

The Race Inputs Block will not error if none of the inputs finish. Instead, the `Result` output will be control-flow-excluded. If all inputs are control-flow-excluded, the output will also be control-flow-excluded.

## Technical Details

* Input ports are dynamically created based on the highest numbered connected input port plus one
* Input ports are named "input1", "input2", etc.
* The output port is named "result"

## FAQ

<AccordionGroup>
  <Accordion title="What happens if none of the inputs finish?">
    If none of the inputs finish, the Race Inputs Block will not error. The `Result` output will be control-flow-excluded.
  </Accordion>

  <Accordion title="Can I use the Race Inputs Block with inputs of different data types?">
    Yes, the Race Inputs Block can handle inputs of any data type.
  </Accordion>

  <Accordion title="What happens if one of the inputs errors?">
    If one of the inputs errors, the Race Inputs Block will not be affected. It will still output the value of the first input to finish, regardless of whether other inputs error.
  </Accordion>
</AccordionGroup>

## See Also

* [HTTP Call Block](/block-reference/advanced/http-call)
* [If Block](/block-reference/logic/if-else)
* [Match Block](/block-reference/logic/match)
* [Coalesce Block](/block-reference/logic/coalesce)
