# or

`function` in `core` · v0.12.0

<https://seedcord.org/docs/packages/core/0.12.0/functions/or>

Runs each gate in order and passes on the first gate that passes. Takes two or more gates. The
required context is the union of their contexts. A handler that matches any one gate fits. When every
gate refuses it throws the trailing [`OrOptions`](/docs/packages/core/0.12.0/interfaces/or-options) `fail` if given, else a list built from each
refusal's `summary`, else a default refusal. The trailing options object does not count as a gate.

## Signature 1

```ts
or<Gates>(
    gates: Gates
): Gate<
    RequiredOf<Gates[number]>,
    JoinNames<Gates, " | ">
>
```

Runs each gate in order and passes on the first gate that passes. Takes two or more gates. The
required context is the union of their contexts. A handler that matches any one gate fits. When every
gate refuses it throws the trailing [`OrOptions`](/docs/packages/core/0.12.0/interfaces/or-options) `fail` if given, else a list built from each
refusal's `summary`, else a default refusal. The trailing options object does not count as a gate.

Parameters.

- `gates` `Gates` — The gates to try in order, with an optional trailing [`OrOptions`](/docs/packages/core/0.12.0/interfaces/or-options) object.

Returns `Gate<RequiredOf<Gates[number]>, JoinNames<Gates, ' | '>>`.

## Signature 2

```ts
or<Gates>(
    args: [...Gates, OrOptions]
): Gate<
    RequiredOf<Gates[number]>,
    JoinNames<Gates, " | ">
>
```

Parameters.

- `args` `[...Gates, OrOptions]`

Returns `Gate<RequiredOf<Gates[number]>, JoinNames<Gates, ' | '>>`.
