> For the complete documentation index, see [llms.txt](https://demystifyfp.gitbook.io/fstoolkit-errorhandling/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling.icedtasks/valuetaskvalueoption/either.md).

# either

Namespace: `FsToolkit.ErrorHandling`

## Function Signature

Provide two functions to execute depending on the value of the voption. If the voption is `ValueSome`, the first function will be executed. If the voption is `ValueNone`, the second function will be executed.

```fsharp
(onValueSome : 'T -> ValueTask<'output>) 
	-> (onValueNone : unit -> ValueTask<'output>) 
	-> (input : ValueTask<'T voption>) 
	-> ValueTask<'output>
```

## Examples

### Example 1

```fsharp
ValueTaskValueOption.either (fun x -> valueTask { return x * 2 }) (fun () -> valueTask { return 0 }) (ValueTaskValueOption.valueSome 5)

// valueTask { 10 }
```

### Example 2

```fsharp
ValueTaskValueOption.either (fun x -> valueTask { return x * 2 }) (fun () -> valueTask { return 0 }) (ValueTask<_>(ValueNone))

// valueTask { 0 }
```
