The OpenD Programming Language

YearQuarter.add

  1. YearQuarter add(long quarters)
  2. YearQuarter add(long years)
    struct YearQuarter
    deprecated @safe pure nothrow @nogc ref
    add
    (
    string units : "years"
    )
    (
    long years
    )

Examples

auto yq0 = YearQuarter(2020, Quarter.q1);

yq0.add!"years"(1);
assert(yq0.year == 2021);
assert(yq0.quarter == Quarter.q1);

auto yq1 = yq0.add!"years"(1);
assert(yq1.year == 2022);
assert(yq1.quarter == Quarter.q1);

// also changes yq0
assert(yq0.year == 2022);
assert(yq0.quarter == Quarter.q1);

Meta