The Comma Operator's Deprecation Can't Come Soon Enough
Meta via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 23 12:30:32 PDT 2014
On Wednesday, 23 July 2014 at 19:04:52 UTC, Ali Çehreli wrote:
> Reminds me... Is everybody aware of D's for syntax?
>
> import std.stdio;
>
> void main()
> {
> for ( {
> int i = 42;
> double d = 1.5;
> string s = "hello";
> } i < 100; i *= 2) {
>
> writefln("In the loop with %s %s %s", i, d, s);
> }
> }
>
> :)
>
> Also note the absence of ; before the loop condition.
>
> Ali
What in the hell is this? Is the { int i = 42; ... } block
counted as a lambda or a scope? In that case, why is i still
available outside the block in the `i < 100; i *= 2` expressions?
I feel like my whole world has been turned upside down.
More information about the Digitalmars-d
mailing list