#define-like behavior

Paul Backus snarwin at gmail.com
Wed Mar 15 19:27:19 UTC 2023


On Wednesday, 15 March 2023 at 16:40:52 UTC, bomat wrote:
> Just out of curiosity:
> Can you explain to me why this is called an `enum` although 
> it's clearly not an enumeration?
> Seems like a random abuse of a keyword...

It's shorthand for defining an unnamed `enum` with a single 
member:

```d
enum
{
     myString = "hello"
}
```

D lets you leave out the `{}` in this case, for convenience.


More information about the Digitalmars-d-learn mailing list