Function Option.or

Returns the encapsulated value if available or a default value otherwise.

inout U or(U) (
  U defaultValue
) @property
if (is(U == T) && isCopyable!T);

inout ref inout(T) or (
  ref inout(T) defaultValue
) @property;

Note that the contained value can be returned by reference only if the default value is passed by reference as well.

Parameters

NameDescription
U Type of the default value.
defaultValue Default value.

Returns

The value of this Option if available, defaultValue otherwise.

See Also

isNothing, get.