# branch

```erlang
branch :: (Function f, Function g, Function h, ...)
    => (a, b, c, ...)
    => Array [f(a, b, c, ...), g(a, b, c, ...), h(a, b, c, ...), ...]
```

## description

`branch` takes as many functions as you want as parameters and creates branches (think Git branches) with them. It returns a new function which will forward whatever arguments are passed to the different branches you created, and return an array where each item is the result of a branch function. The branches are run in *parallel*.

## example

```javascript
import { branch } from 'conductor'

const numbers = [1, 3, 5]
const sum = (...args) => args.reduce((a, b) => a + b)
const multiply = (...args) => args.reduce((a, b) => a * b)
const sumAndMultiply = branch(sum, multiply)

sumAndMultiply(numbers) // [9, 15]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://conductor.js.org/master/api-reference/branch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
