frontOr

Retrieves the front of a range or a default value

frontOr
(
Range
T
)
(
Range range
,
)
if (
from!"std.range".isInputRange!Range &&
is(T : from!"std.range".ElementType!Range)
)

Examples

assert((int[]).init.frontOr(7) == 7);
assert([1, 2].frontOr(3) == 1);

Meta

Since

- 0.0.1