One of the thing I like in D

Boaz Ampleman ba at 1234.de
Mon Oct 7 20:03:46 UTC 2024


```d
void main()
{
     auto a = 0;
     auto b = 0;
     auto c = 1;

     auto ptr = &(c ? a : b);
     *ptr = 8;
     assert(a == 8);
     ptr = &(c ? b : a);
     *ptr = 2;
     assert(a + b == 10);
}
```

It's just beautiful


More information about the Digitalmars-d mailing list