The OpenD Programming Language

YearMonth.addYears

struct YearMonth
nothrow @safe pure nothrow @nogc
addYears
(
long years
)

Examples

auto ym0 = YearMonth(2020, Month.jan);

auto ym1 = ym0.addYears(1);
assert(ym1.year == 2021);
assert(ym1.month == Month.jan);

// leaves ym0 unchanged
assert(ym0.year == 2020);
assert(ym0.month == Month.jan);

Meta