static foreach declaration already defined

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Thu Aug 27 09:45:33 UTC 2026


On 27/08/2026 9:40 PM, Ssenni wrote:
> If I recall, there used to be a trick for static foreach using double 
> braces, but the compiler complains "declaration expected not {".

Double braces isn't a thing.

What you've seen is a scope statement.

```d
void func() {
	{

	}
}

```

Since you're working as a declaration of course it won't work.



More information about the Digitalmars-d-learn mailing list