"for" statement issue
Marc Schütz via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 22 09:41:33 PDT 2016
On Friday, 21 October 2016 at 13:42:49 UTC, Adam D. Ruppe wrote:
> On Friday, 21 October 2016 at 13:33:26 UTC, Stefan Koch wrote:
>> It does create a lambda?
>> Hmm that should not happen.
>
> Eh, that's exactly what the language rules say should happen,
> and it actually does make sense to me... you might even want to
> use an immediately-called lambda to group several statements
> together into one expression.
>
int j;
for({j=2; int d = 3; } j+d<7; {j++; d++;}) {
}
I'm more surprised by the fact that `d` is declared inside the
first curly braces, but is evidently still in scope outside of
it...
More information about the Digitalmars-d
mailing list