OptTOr(OptT) Method

Combines two options: this and other as follows:
  • returns this if this is Some;
  • returns other otherwise.

In other words, this is a flattened alternative to UnwrapOr(T).

C#
var or = Some(12).Or(Some(13));
Assert.Equal(Some(12), or);

or = Some(12).Or(None<int>());
Assert.Equal(Some(12), or);

or = None<int>().Or(Some(13));
Assert.Equal(Some(13), or);

or = None<int>().Or(None<bool>());
Assert.True(or.IsNone);

Definition

Namespace: Orx.Fun.Option
Assembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
C#
public Opt<T> Or(
	Opt<T> other
)

Parameters

other  OptT
Other option to combine with.

Return Value

OptT

See Also