Getting a total from a user defined variable

Joel joelcnz at gmail.com
Fri Apr 21 05:23:14 UTC 2023


On Thursday, 20 April 2023 at 21:28:48 UTC, John Chapman wrote:
> On Thursday, 20 April 2023 at 19:41:21 UTC, Joel wrote:
>> // how do I get the total of ages added together?
>
> p.map!(x => x.age).sum();

Or: p.map!"a.age".sum; works too.


More information about the Digitalmars-d-learn mailing list