> With that idea your struct becomes:

Or just:

struct Foo {
    int a, b, c, d, sum, average;

    this(this.a, this.b, this.c, this.d) {
        sum = a + b + c + d;
        average = (a + b + c + d) / 4;
    }
}

Bye,
bearophile

Reply via email to