> For the complete documentation index, see [llms.txt](https://conductor.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://conductor.js.org/api-reference/branch.md).

# 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]
```
