Alias or
Retrieves the value if it is a valid value else it will retrieve the elseValue
. Instead of
an elseValue
, an elsePred
can be passed to create the value functionally
alias or
;
See optiona.or for details
Since
- 0.0.2
Example
// Get or ranges
assert((int[]) .init .or([1, 2, 3]) .equal([1, 2, 3]));
assert(([789]) .or([1, 2, 3]) .equal([789]));
// Lambdas
assert(([789]) .or!(() => [1, 2, 3]) .equal([789]));