Structure initializer VS lambda function

Tim tim.dlang at t-online.de
Mon Dec 12 17:00:48 UTC 2022


On Monday, 12 December 2022 at 08:54:33 UTC, realhet wrote:
> 1. checking inside (on the first hierarchy level inside {})
>    ,   => must be a struct initializer
>    ;   => must be a lambda
>    no , and no ;  => check it from the outside

Some statements don't end in a semicolon, so you would also need 
to check for those. For example:
```
auto lambda = { while(f()){} };
```

A lambda can also contain a comma expression:
```
auto lambda = { f(), g(); };
```


More information about the Digitalmars-d-learn mailing list