Feature or bug: print braces

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 15 11:59:34 PDT 2015


On Friday, 15 May 2015 at 08:44:41 UTC, Ivan Kazmenko wrote:
> Somehow reminds me of this lambda:
> https://github.com/Hackerpilot/Idiotmatic-D/blob/master/idiotmatic.d#L127-L128

Maybe it generally blocks for initialization of variables:
https://github.com/Hackerpilot/Idiotmatic-D/blob/master/idiotmatic.d#L130-L131

-----
for ( { int i = 0; } i < 5; ++i ) {
	writeln("test");
}

It seems to me that this should be fixed :)

-----
int x;

void foo(int tmp) {
	x = tmp;
}
...
writeln( { int i = 5; writeln(i); foo(i); });
writeln(x);


More information about the Digitalmars-d-learn mailing list