Is there any real reason to use "const"?
Dennis
dkorpel at gmail.com
Mon Jan 24 18:17:38 UTC 2022
On Monday, 24 January 2022 at 17:55:39 UTC, H. S. Teoh wrote:
> If-statements are another trap waiting to happen... but so far
> I've found it very hard to resist the conciseness of:
That's why I use 'Egyptian braces' with a 'cuddled else':
```D
if (x == y) {
doSomething();
} else if (y == z) {
doSomethingElse();
} else {
doYetAnotherThing();
}
```
Not the prettiest, but compact and safe.
More information about the Digitalmars-d
mailing list